[R] the bar width of barchart plot in lattice package

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Apr 23 17:14:59 CEST 2010


On Wed, Apr 21, 2010 at 8:55 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> On Apr 21, 2010, at 9:51 PM, zhenjiang xu wrote:
>
>> I tried that. It seems the bar width is already maximized, although there
>> is a lot of space between groups of bars. Thank you anyway.
>
> I apologize. It was reproducible code. I missed the "values" assignment.
> There is also a box.width argument which does affect how the plot gets
> drawn, but the effects do not appear salutory. It appears that the alignment
> of the bars gets shifted relative to the labels. The barchart function
> cannot seem to deal with the completity of the 2 * 5 factor crossed with a
> c(3,3,4) factor. On the other hand that problem seems to be present in the
> original plot as well. Maybe you should re-think the structure of the data?

The problem is that levels is nested within factors:

> xtabs(~levels + factors, a)
                           factors
levels                      Cycles MaxPairs Order
  Cycle 1                       10        0     0
  Cycle 2                       10        0     0
  Cycle 3                       10        0     0
  Cycle 4                       10        0     0
  Order 1                        0        0    10
  Order 2                        0        0    10
  Order 3                        0        0    10
  MaxPairs = 20                  0       10     0
  MaxPairs = Average Length      0       10     0
  MaxPairs = 500                 0       10     0

I can't think of a meaningful design that would give the desired result here.

-Deepayan



More information about the R-help mailing list