0

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))
Kardinol
  • 191
  • 1
  • 11
  • You should be using `method.args=list()` for your `start=` parameter. Did `ggplot` not give you an error or warning? What version of `ggplot` are you using? – MrFlick Dec 10 '18 at 21:38
  • For me, there's a warning about the wrong specification of starting values, but then a default is used and I get a line. So this is not reproducible for me. – Axeman Dec 10 '18 at 21:39

0 Answers0