I want to annotate mean of each boxplot using ggplot2
. However, I could not figure out how to horizontally center the symbols marking the means within their respective boxes (see image below).
MWE is below for reference:
library(ggplot2)
ggplot(data=mpg, mapping=aes(x=class, y=hwy)) +
geom_boxplot(aes(color = drv), outlier.shape = NA) +
stat_summary(fun.y = mean, geom = "point", size=2, aes(shape = drv, color = drv)) +
theme_bw()
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…