Here is one way. You can change the schedule according to your needs:
library(ggplot2) x <- seq(mean(h) - 4 * sd(h), mean(h) + 4 * sd(h), 0.01) df <- data.frame(x = x, d = dnorm(x, mean(h), sd(h))) ggplot(df, aes(x = x, y = d)) + geom_line() + theme_bw() + geom_vline(xintercept = c(mean(h) + 3 * sd(h), mean(h) - 3 * sd(h)), col = 'red') + xlim(120, 240)
If you do not like these vertical lines, you can try this:
ggplot(df, aes(x = x, y = d)) + geom_line() + theme_bw() + geom_segment(aes(x = mean(h) - 3 * sd(h), xend = mean(h) - 3 * sd(h), y = 0, yend = dnorm(mean(h) - 3 * sd(h), mean(h), sd(h)), col = 'red')) + geom_segment(aes(x = mean(h) + 3 * sd(h), xend = mean(h) + 3 * sd(h), y = 0, yend = dnorm(mean(h) + 3 * sd(h), mean(h), sd(h)), col = 'red')) + xlim(120, 240) + ylim(-0.001, 0.041)
source share