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