How to Insert Error bars on stacked barplot in R - barplot2() "gplots" -


i create stacked barplot unidirectional error bars (to avoid overlapping) in r. however, when use barplot2 function of gplots , omit besides=t, automatic display of error bars inhibited.

here dummy dataset represent data:

bm=data.frame(treatment=gl(3,4,24,labels=c("t1","t2","t3")), loc=gl(2,12,24,labels=letters[1:2]),ind=gl(4,1,24,labels=c(1,2,3,4)), weight=runif(24)) 

i used following codes:

mean.bm=tapply(weight,list(loc,treatment),mean) sd.bm=tapply(weight,list(loc,treatment),sd)  bplot1=barplot2(mean.bm,panel.first=t,plot.ci=t,               ci.u=mean.bm+(0.5*sd.bm), col=c("grey30","grey80")) 

unfortunately cannot post images yet, hope question clear anyway!

i aware there more elegant ways ggplot2, since not familiar package prefer solution gplots. if not possible, grateful other suggestion of course!


Comments