Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Use stat_summary(). The
mean is often shown with a diamond, so we’ll use shape 23
with a white fill. We’ll also make the diamond slightly larger by
setting size=3 (Figure 6-20):
library(MASS)# For the data setggplot(birthwt,aes(x=factor(race),y=bwt))+geom_boxplot()+stat_summary(fun.y="mean",geom="point",shape=23,size=3,fill="white")