library(gplots) source("myvioplot.R") ## hacked version of violin plot to add axes= argument ## compute summary statistics m <- with(OrchardSprays,tapply(log10(decrease),treatment,mean)) s <- with(OrchardSprays,tapply(log10(decrease),treatment,sd)) n <- with(OrchardSprays,table(treatment)) se <- s/sqrt(n) ## hack for violin plots vdat <- with(OrchardSprays,split(log10(decrease),treatment)) names(vdat) <- c("x",rep("",7)) png("dotbarbox.png") op <- par(mfrow=c(2,3),mar=c(0,0,3,0)) barplot2(m,plot.ci=TRUE,ci.l=m-2*se,ci.u=m+2*se,ann=FALSE,axes=FALSE, names="",main="dynamite") box() plotCI(1:8,m,2*se,pch=16,axes=FALSE,main="points+errbar") box() plot(1:8,m,pch=16,axes=FALSE,ylim=range(c(m-2*se,m+2*se))) segments(1:8,m-se,1:8,m+se,lwd=3) segments(1:8,m-2*se,1:8,m+2*se,lwd=1) title(expression(paste("points",{} %+-% 1," or ", 2," SE"))) box() stripchart(decrease~treatment,vertical=TRUE,data=OrchardSprays,log="y", axes=FALSE,xlab="",ylab="",main="strip/dot") box() boxplot(decrease~treatment,data=OrchardSprays,log="y",notch=TRUE, ann=FALSE,axes=FALSE,main="notched boxplot") box() do.call("vioplot",c(vdat,list(col="gray",axes=FALSE))) title(main="violin") par(op) dev.off()