Skip to content
Prev 207832 / 398506 Next

different x-axes in Lattice

On Sun, Jan 24, 2010 at 5:24 AM, Robert Ruser <robert.ruser at gmail.com> wrote:
The short answer is that empty factor levels will be omitted only if
they are at the boundary (because what are actually plotted on the
x-axis here are the numeric factor codes). For example,

barchart(yield ~ reorder(variety, yield, length) | site, data = barley2,
       groups = year, layout = c(1,6),
       scales = list(y = "free",x="free"))

If you want to omit levels in the middle, you need to actually change
the internal codes using 'x[drop=TRUE]' where 'x' is your factor with
the missing levels. Lattice has no built-in facility to do that, but
you can do it yourself in custom prepanel and panel functions.

-Deepayan