Re: [R] thickness of boxplots

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Mon, 10 Nov 2008 23:25:33 -0800

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.

-Deepayan



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 11 Nov 2008 - 07:27:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 11 Nov 2008 - 07:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive