[R] Standard error bars on bar plots
Hi, I know there have been numerous posts about this but I am unable to find one, or at least carry out one, that gives me the plot I want. I have managed to add the error bars to the plot, but they end up not aligned with the centre of the bars themselves. Here is my script: means-c(0.13528,0.082829167,0.2757625) SE-c(0.036364714,0.039582896,0.06867608) halfSE-c(0.018182357,0.019791448,0.03433804) barx-barplot(means,main=Proportion of time spent in AMU sector,xlab=Treatments,ylab=Proportion of time,names.arg=c(Solitary,Size-matched conspecific,Sub-adult conspecific),cex.names=0.85,axis.lty=1,ylim=c(0,0.4)) library(gplots) plotCI(x=means,uiw=halfSE,lty=1,gap=0,add=TRUE) Thanks for any suggestions or help you may have, CJ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Standard error bars on bar plots
On 12.08.2011 18:43, Christopher Crooks wrote: Hi, I know there have been numerous posts about this but I am unable to find one, or at least carry out one, that gives me the plot I want. I have managed to add the error bars to the plot, but they end up not aligned with the centre of the bars themselves. Here is my script: means-c(0.13528,0.082829167,0.2757625) SE-c(0.036364714,0.039582896,0.06867608) halfSE-c(0.018182357,0.019791448,0.03433804) barx-barplot(means,main=Proportion of time spent in AMU sector,xlab=Treatments,ylab=Proportion of time,names.arg=c(Solitary,Size-matched conspecific,Sub-adult conspecific),cex.names=0.85,axis.lty=1,ylim=c(0,0.4)) library(gplots) plotCI(x=means,uiw=halfSE,lty=1,gap=0,add=TRUE) plotCI(x=barx, y=means,uiw=halfSE,lty=1,gap=0,add=TRUE) Uwe Ligges Thanks for any suggestions or help you may have, CJ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Standard error bars on bar plots
Or ?barplot2 barplot2(means,main=Proportion of time spent in AMU sector,xlab=Treatments,ylab=Proportion of time,names.arg=c(Solitary,Size-matched conspecific,Sub-adult conspecific),cex.names=0.85,axis.lty=1,ylim=c(0,0.4), plot.ci=TRUE,ci.l=means,ci.u=means+halfSE) Mikhail -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Uwe Ligges Sent: Friday, August 12, 2011 12:04 PM To: Christopher Crooks Cc: r-help@r-project.org Subject: Re: [R] Standard error bars on bar plots On 12.08.2011 18:43, Christopher Crooks wrote: Hi, I know there have been numerous posts about this but I am unable to find one, or at least carry out one, that gives me the plot I want. I have managed to add the error bars to the plot, but they end up not aligned with the centre of the bars themselves. Here is my script: means-c(0.13528,0.082829167,0.2757625) SE-c(0.036364714,0.039582896,0.06867608) halfSE-c(0.018182357,0.019791448,0.03433804) barx-barplot(means,main=Proportion of time spent in AMU sector,xlab=Treatments,ylab=Proportion of time,names.arg=c(Solitary,Size-matched conspecific,Sub-adult conspecific),cex.names=0.85,axis.lty=1,ylim=c(0,0.4)) library(gplots) plotCI(x=means,uiw=halfSE,lty=1,gap=0,add=TRUE) plotCI(x=barx, y=means,uiw=halfSE,lty=1,gap=0,add=TRUE) Uwe Ligges Thanks for any suggestions or help you may have, CJ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.