I've been looking around online and I can't find a clear answer how to fill different sections under the normal distribution using ggplot and stat_function --> dnorm.
#Parameters
mu = 18.7
sigma = 36.4
n = 168
x = c(mu - 4*sigma/sqrt(n), mu + 4*sigma/sqrt(n))
Here's what I have for the plot
ggplot(data, aes(x)) +
stat_function(fun = dnorm,
args = list(mean = mu, sd = sigma/sqrt(n)),
geom = "area",
fill = "steelblue")
What I want is to fill the first standard deviation one color, the second another color, and so on. I've also noticed that the curve does not appear smooth. Any reason why?
Thanks in advance.

