[R] Control of box and staple width in boxplot()

John Maindonald john.maindonald at anu.edu.au
Fri May 19 00:46:53 CEST 2000


I'd like to make the following changes (differences are from R1.0.1):

boxplot.default()
1c1
< function (x, ..., range = 1.5, width = NULL, varwidth = FALSE, 
---
> function (x, ..., range = 1.5, width = NULL, varwidth = FALSE,
boxwex=0.8,
37c37,38
<         bxp(groups, width, varwidth = varwidth, notch = notch, 
---
>         bxp(groups, width, varwidth = varwidth, boxwex=boxwex, 
>             notch = notch, 

bxp()
1c1,2
< function (z, notch = FALSE, width = NULL, varwidth = FALSE,
notch.frac = 0.5, 
---
> function (z, notch = FALSE, width = NULL, varwidth = FALSE, 
>     boxwex=0.8, notch.frac = 0.5, 
52c53
<         0.8 * width/max(width)
---
>         boxwex * width/max(width)
55c56
<         0.8 * sqrt(unlist(lapply(z, "[[", "n"))/nmax)
---
>         boxwex * sqrt(unlist(lapply(z, "[[", "n"))/nmax)
57,58c58,59
<         0.4
<     else rep(0.8, n)
---
>         0.5*boxwex
>     else rep(boxwex, n)

Examples:
 data(PlantGrowth)
 boxplot(split(PlantGrowth$weight,PlantGrowth$group))
 boxplot(split(PlantGrowth$weight,PlantGrowth$group),boxwex=0.1)
 boxplot(split(PlantGrowth$weight,PlantGrowth$group),boxwex=0.8)
     # This last command gives the same result as the default.

My view is that the default should be more like boxwex=0.1 .
In the default style of boxplot, the horizontal dimension
of the box carries no information.

John Maindonald.
John Maindonald               email : john.maindonald at anu.edu.au        
Statistical Consulting Unit,  phone : (6249)3998        
c/o CMA, SMS,                 fax   : (6249)5549  
John Dedman Mathematical Sciences Building
Australian National University
Canberra ACT 0200
Australia

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