ggplot2:在箱线图上按 x 轴 class 绘制因子的平均点(和连接它们的线)

ggplot2: plot mean points(and lines connecting them) of the factor by x-axis class on a boxplot

我想在每个尺寸(x 轴)上绘制因子(MAP)的每个平均值,有人可以帮我吗?

qplot(Size,Rc,data=rc.data, geom="boxplot") + 
  geom_point(aes(color=factor(MAP)))

使用stat_summary计算并绘制均值:

qplot(Size,Rc,data=rc.data, geom="boxplot") + 
  geom_point(aes(color=factor(MAP))) +
  stat_summary(fun.y=mean, geom="line", aes(colour=factor(MAP), group=factor(MAP))) +
  stat_summary(fun.y=mean, geom="point", aes(colour=factor(MAP), pch=3, size=3)