And here it is with a reprex. I changed three things from @DavoWW's excellent answer.
- I defined
dd as a function based on dnorm
- I used
stat_function(dd) instead of geom_density
- I put in a dummy data frame, because
ggplot2 really wants data even if all of the plotting comes from other things.
library(ggplot2)
all_mean <- 100
all_sd <- 30
my_score <- 157
dd <- function(x) { dnorm(x, mean=all_mean, sd=all_sd) }
z <- (my_score - all_mean)/all_sd
pc <- round(100*(pnorm(z)), digits=0)
t1 <- paste0(as.character(pc),"th percentile")
p33 <- all_mean + (qnorm(0.3333) * all_sd)
p67 <- all_mean + (qnorm(0.6667) * all_sd)
ggplot(data.frame(x=c(0, 180)), aes(x=x)) +
stat_function(fun=dd) +
geom_vline(aes(xintercept=my_score), colour="red") +
geom_label(aes(x=my_score, y=0.001, label=t1)) +
geom_label(aes(x=my_score, y=0.01, label=as.character(my_score))) +
geom_segment(aes(x=0, y=0.014, xend=p33, yend=0.014), colour="blue") +
geom_segment(aes(x=p33, y=0.014, xend=p67, yend=0.014), colour="orange") +
geom_segment(aes(x=p67, y=0.014, xend=200, yend=0.014), colour="darkgreen") +
geom_text(aes(x=p33/2, y=0.0145, label="Novice"), colour="blue") +
geom_text(aes(x=all_mean, y=0.0145, label="Intermediate"), colour="orange") +
geom_text(aes(x=200-(200-p67)/2, y=0.0145, label="Advanced"), colour="darkgreen") +
ylim(0, 0.015) +
labs(x="Score", y="Frequency") +
theme(legend.position='none')

Created on 2019-09-08 by the reprex package (v0.3.0)