[R] modifications using “stat_summary” in ggplot
michael.eisenring at agroscope.admin.ch
michael.eisenring at agroscope.admin.ch
Wed Apr 22 11:32:11 CEST 2015
Dear R-list members
I am using stat_summary in ggplot to plot a error bar graph comparing three treatmens (damage, see code below).
I would like to change the shape of the three symbols displaying the mean values (e.g one symbol should be a point (default) one should be a triangle and one should be a square). Furthermore, I would like that the outlines of my error bars are black (and that I can fill them with whatever color I want ( I used white, black and gray65).
Does Anyone of you know how to solve these problems?
I use the following code:
line<-ggplot(data,aes(leaf,cor_average,fill=damage, colour=damage))
#define x (leaf) and y (cor_average) variables within aes() and that they should be colored according to damage type
line+stat_summary(fun.y=mean, geom="point", size=3)+
#add mean as point symbol
stat_summary(fun.data=mean_cl_boot,geom="errorbar",width=0.3, size=0.75)+
scale_colour_manual(values=c("white","black","gray65"))+
#add CI : width=width of CI whiskers, size=widht of the CI bar
labs(x="Leaf",y="Average nr. glands corrected for leaf sz.")
Thank you very much,
Michael
Eisenring Michael, Msc.
PhD Student
Federal Department of Economic Affairs, Education and Research
EAER
Institute of Sustainability Sciences ISS
Biosafety
Reckenholzstrasse 191, CH-8046 Zürich
Tel. +41 44 37 77181
Fax +41 44 37 77201
michael.eisenring at agroscope.admin.ch<mailto:michael.eisenring at agroscope.admin.ch>
www.agroscope.ch<http://www.agroscope.ch/>
[[alternative HTML version deleted]]
More information about the R-help
mailing list