[R] Standard error bars on bar plots

Christopher Crooks Christopher.Crooks at student.manchester.ac.uk
Fri Aug 12 18:43:07 CEST 2011


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)

Thanks for any suggestions or help you may have,
CJ


More information about the R-help mailing list