fitting a exponential regression line to scatterplot

Hi!

How do I add an exponential regression line in the same image as the scatter plot.

To summerize I want these two images to be in one.
ggplot(data=lampor, mapping=aes(x=styrka, y=tid))+geom_point()+
theme_minimal()
image

ggplot(data=lampor, mapping=aes(x=styrka, y=my))+geom_line()+
theme_minimal()

Sorry about the messy code and lingo, first time using R.

Thanks

I cannot test this because I do not have your data but I think this will work.

ggplot(data=lampor, mapping=aes(x=styrka)) + geom_point(mapping = aes(y = tid))+
geom_line(mapping=aes(y=my)) +
theme_minimal()
1 Like

You can add the ylim() function to code for the plot.

ggplot(data=lampor, mapping=aes(x=styrka)) + geom_point(mapping = aes(y = tid))+
geom_line(mapping=aes(y=my)) + ylim(0,5000) +
theme_minimal()
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Thank you that worked excellent! This was the output.image

Do you know how I could limit the Y-axis to 5000?