[R] boxplot(list(m[,1],...,m[,c]))

Roger Bivand Roger.Bivand at nhh.no
Thu Jul 5 12:57:27 CEST 2001


On Thu, 5 Jul 2001, Gavin Simpson wrote:

> > >>>>> "Richard" == Richard Dybowski <rdybowski at btinternet.com> writes:
> > 
> >     Richard> Given a matrix m, I would like to obtain a boxplot of the
> >     Richard> columns of m; in other words,
> > 
> > Use
> >         boxplot(data.frame(m))
> 
> but have different scales for each of the boxplots?
> 
> The reason I ask is that I have a series of lake chemistry measurements
> and I want to plot a diagram with boxplots for a number of variables. 
> The variables are measured in different units and some variables are
> orders of magnitude bigger than others.  Any help with this would be
> appreciated.
> 

I think for this that you are back to:

> oldpar <- par(mfrow=c(1,ncol(mat)))
> invisible(apply(mat,2,boxplot))
> for (i in 1:ncol(mat)) boxplot(mat[,i], main=colnames(mat)[i])
> par(oldpar)

(with a version of the same thing to give labels). If the y scales
are different for the matrix columns, they will need the y-axis, though it
would "save ink" to just have the left y axes plotted, something like:

> for (i in 1:ncol(mat)) {boxplot(mat[,i], main=colnames(mat)[i], axes=F)
+ axis(2)}

Roger

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
and: Department of Geography and Regional Development, University of
Gdansk, al. Mar. J. Pilsudskiego 46, PL-81 378 Gdynia, Poland.


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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