[R] modifications using “stat_summary” in ggplot
jrkrideau at inbox.com
Wed Apr 22 14:50:21 CEST 2015
It would really help to have some sample data to see what is happening. The best way to supply data to the help group is to use dput(). Type >dput for some basic information on using it
Have a look at and/or http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for some hints. For this last link it is a good idea to follow the " reproducible example " link for more concrete suggestions.
By the way calling a data.frame "data" is not a good idea. Data is a predefined function in R . Type ?data to see what I mean.
Kingston ON Canada
> -----Original Message-----
> From: michael.eisenring at agroscope.admin.ch
> Sent: Wed, 22 Apr 2015 09:32:11 +0000
> To: r-help at r-project.org
> Subject: [R] modifications using “stat_summary” in ggplot
> 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)+
> #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,
> Eisenring Michael, Msc.
> PhD Student
> Federal Department of Economic Affairs, Education and Research
> Institute of Sustainability Sciences ISS
> Reckenholzstrasse 191, CH-8046 Zrich
> Tel. +41 44 37 77181
> Fax +41 44 37 77201
> michael.eisenring at agroscope.admin.ch<mailto:michael.eisenring at agroscope.admin.ch>
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!
More information about the R-help