0
我绘制了整个研究人群(黑线)和男性和女性分别的平均值。R ggplot2 stat_summary legend为组别
plotYYIR1<- ggplot(data=YYIR1Long, aes(x=TimeValue, y=YYIR1Value)) +
labs(x="Week number", y="YYIR1 distance run (m)") +
theme(plot.title = element_text(hjust = 0, vjust=0))+
theme(legend.title=element_blank())+
theme(legend.key.width = unit(1, "cm"))+
stat_summary(fun.y = mean,geom = "point", size=2) +
stat_summary(fun.y = mean, geom = "line", size=0.7) +
stat_summary(fun.y = mean,geom = "point", size=2, aes(shape=Sex,colour=Sex)) +
scale_shape_manual(values = c("Male"=17, "Female"=15))+
stat_summary(fun.y = mean, geom = "line", size=0.7, aes(colour=Sex)) +
scale_colour_manual(values = c("#009CEF", "#CC0000"))+
stat_summary(fun.data = mean_cl_normal, geom = "errorbar", width =2)+
stat_summary(fun.data = mean_cl_normal, geom = "errorbar", width =2, aes(colour=Sex))
plotYYIR1
的传说只显示性别,可能有人帮我加黑线和点图例为整个集团?
真棒,非常感谢你许多! – Laura