Setting method as default method in geom_smooth gives different result

Viewed 13983

I'm plotting some data and have the following code:

ggplot(aes(x = x, y = y), data = data) + 
  geom_point(alpha = 1/15, color = 'blue')+
  scale_y_continuous('y')+
  scale_x_continuous('x')+
  geom_smooth(stat = 'smooth', color = 'Red')

The graph looks like this:

enter image description here

But if I specify 'gam' in the the geom_smooth function, like:

geom_smooth(stat = 'smooth', color = 'Red', method = 'gam')

I get a different result:

enter image description here

Why is this happening?

1 Answers
Related