[R] thickness of boxplots

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue Nov 11 08:25:33 CET 2008

On 11/10/08, Kenneth Roy Cabrera Torres <krcabrer at une.net.co> wrote:
> Hi R users:
>  How can I obtain with bwplot boxplots with bwplot whose box width
>  will vary acording to other variable.
>  bwplot(categ1~continuos|categ2,box.ratio=continuos2,data=data.base)
>  But it doesn't work as I expected.

I'm not really sure what you expected. The best I would have expected
is that 'box.ratio' in panel.bwplot is vectorized, and that seems to
be true; so you can do

bwplot(gl(4, 1, 100) ~ rnorm(100), box.ratio = 1:4)

or more directly

bwplot(gl(4, 1, 100) ~ rnorm(100), box.width = (4:1)/4)

If you want the widths to be controlled by another variable, you will
need to write your own panel function that calls panel.bwplot with a
suitable 'box.width' argument. I don't see any obvious rule, since the
number of individual box-and-whisker plots is smaller than the number
of observations.


More information about the R-help mailing list