[R] Standard error bars on bar plots

Uwe Ligges ligges at statistik.tu-dortmund.de
Fri Aug 12 19:04:08 CEST 2011



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.135283333,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 at 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.



More information about the R-help mailing list