r - Plotting only stat_smooth without original ggplot2 data -


i plot data ggplot, , wanted see smoothed lines using stat_smooth.
plot smoothed lines (somehow extract it), without original ggplot.
think it's possible?

here code :

graph <- ggplot(data=forecasttemp, aes(x=price.date, y=price, colour=group)) + geom_line() + scale_colour_hue(guide = "none") graph <- graph + stat_smooth(se = false,  aes(fill = group)) + scale_colour_hue(guide = "none") 

if want plot smoothed lines without original sample points, can omit geom_line(), resulting in:

graph <- ggplot(data=forecasttemp, aes(x=price.date, y=price, colour=group)) +          stat_smooth(se = false,  aes(fill = group)) +           scale_colour_hue(guide = "none") 

unfortunately can not try due lack of reproducible example, make try r base dataset , worked:

library(ggplot2) data(iris) g1 <- ggplot(data=iris, aes(x=sepal.length, y=petal.length, colour=species)) +        scale_colour_hue(guide = "none") + geom_smooth() g1 

Comments