im currently using the geom_smooth function to plot bacterial growth data.
I'm wondering if its possible to display the standard deviation as opposed to the confidence interval calculated by the standard error (as i think is the standard for this function)
Example:
p1<-mtcars %>%
ggplot(aes(x=mpg,cyl)) +
geom_smooth( size=2, span=1,color="tomato",fill="tomato")
So my questions are:
Thanks a lot in advance!
It is possible to do this nowadays directly inside geom_smooth
because we can work out the standard deviation from the calculated standard error inside after_stat
mtcars %>%
ggplot(aes(mpg, cyl)) +
geom_smooth(size = 2, span = 1, color = "tomato", fill = "tomato",
aes(ymax = after_stat(y + se * sqrt(length(y))),
ymin = after_stat(y - se * sqrt(length(y)))))