Here is my data:
df <-read.table(text="x group y
1 A 0.5
2 A 0.25
3 A 0.1
1 B 0.6
2 B 0.7
3 B 0.2", header=TRUE)
What I'm trying to do is plot an exponential Best Fit curve to the data. I would prefer to show the upper trend of an exponential curve to just a normal geom_smooth() curve to convey that values for X=1 tend to be higher and avoid a dip in the Group B curve. My code so far is only generating the points but not the curve. What am I doing wrong?
ggplot(df, aes(x,y)) +
geom_point() +
stat_smooth(method = 'nls', formula = y~ a*exp(b *x), aes(colour =
'Exponential'), se = FALSE, start = list(a=1,b=1))