I'm interested in creating an example plot (ideally using ggplot) that will display two normal curves with different means and different standard deviations. I've discovered ggplot's stat_function() argument but am not sure how to get a second curve on the same plot.
This code produces one curve:
ggplot(data.frame(x = c(-4, 4)), aes(x)) + stat_function(fun = dnorm)
Any advice on ways to get a second curve? Or maybe simpler to do in base package plotting?
plot(NA,xlim=c(-4,4),ylim=c(0,1));curve(dnorm(x,mean=1,sd=0.5), col="blue", add=TRUE);curve(dnorm(x,mean=0,sd=1), col="red", add=TRUE)
– thelatemail