Andrew Redd
Andrew Redd

Reputation: 4692

How do I increase the number of evaluation points in geom_smooth for ggplot2 in R

I'm creating a plot and adding a basic loess smooth line to it.

qplot(Age.GTS2004., X.d18O,data=deepsea, geom=c('point')) + 
geom_smooth(method="loess",se=T,span=0.01, alpha=.5, fill='light blue',color='navy')

The problem is that the line is coming out really choppy. I need more evaluation point for the curve in certain areas. Is there a way to increase the number of evaluation points without having to reconstruct geom_smooth?

Upvotes: 4

Views: 1585

Answers (2)

Allan Stokes
Allan Stokes

Reputation: 535

Hadley: The documentation leads people astray. geom_smooth does not document that it accepts parameters on behalf of stat_smooth, nor is there any link on that page to stat_smooth for continued reading.

I figured the parameter was buried on some other help page, but I landed here to clue in where.

Upvotes: 2

hadley
hadley

Reputation: 103898

Use the n parameter, as documented in stat_smooth.

Upvotes: 4

Related Questions