[R] boxplot question

Jim Lemon bitwrit at ozemail.com.au
Fri Apr 7 14:40:42 CEST 2000


Christine Serres wrote:

Can anyone tel me how to plot two boxplot at the same abscisse value
?...

I may be mistaken, but I think you mean on equivalent ordinates.  If so,
here's a start.

test1<-rnorm(100)
test2<-rnorm(100)
par(mfcol=c(1,2),mar=c(5,6,4,2))
ymin<-floor(min(c(test1,test2)))
ymax<-ceiling(max(c(test1,test2)))
boxplot(test1,ylim=c(ymin,ymax))
par(mar=c(5,4,4,4))
boxplot(test2,ylim=c(ymin,ymax))
par(mfcol=c(1,1),mar=c(5,4,4,2))
rm(test1,test2)

This simply puts two boxplots side by side with the same ordinates.  In
doing this, I discovered that you can't turn off the box in boxplot
(d'oh!) and thus I couldn't work out a way to plot the two boxless
boxplots, then wrap an empty frame around them.  Virtual applause for
the one who cracks that.

Jim

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list