[R] Lattice: hiding only some strips

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Jun 22 23:08:13 CEST 2007


On 6/22/07, Michael Hoffman <b3i4old02 at sneakemail.com> wrote:
> I am using R 2.4.0 and lattice to produce some xyplots conditioned on a
> factor and a shingle. The shingle merely chops up the data along the
> x-axis, so it is easy to identify which part of the shingle a panel is
> in by looking at the x-axis markings. I only want to have a strip at the
> top for the factor.
>
> Is this possible? I looked into calculateGridLayout() and it seems to me
> that there isn't an easy way to do it without rewriting that function
> (and others).

It's nowhere near that complicated, you just need to write your own
strip function. E.g.,

mtcars$HP <- equal.count(mtcars$hp)

xyplot(mpg ~ disp | HP + factor(cyl), mtcars,
       par.strip.text = list(lines = 0.5),
       strip = function(which.given, which.panel, ...) {
           if (which.given == 2)
               strip.default(which.given = 1,
                             which.panel = which.panel[which.given],
                             ...)
       })

-Deepayan



More information about the R-help mailing list