Reputation: 397
I am trying to make a scatter plot in ggplot and would like to loose the points and show only the smooth line and the confidence interval. I checked geom_point()
function and there is no option for turning it off such that the points/underlying data is hidden. Any suggestions? much appreciated.
Joseph
Upvotes: 0
Views: 3008
Reputation: 98449
To plot smooth line with confidence interval around the line you should use geom_smooth()
. This will smoothed line using loess if there are less than 1000 observations and gam if more. But you can change smoothing method with argument method=
.
ggplot(mtcars,aes(wt,mpg))+geom_smooth()
Upvotes: 1