Skip to content
Prev 154141 / 398500 Next

lattice : using both strip and strip.left

On Mon, Aug 25, 2008 at 4:47 AM, baptiste auguie <ba208 at exeter.ac.uk> wrote:
Yes; the simplest solution is to use the useOuterStrips() function
from latticeExtra.
If you mean automatically, then panel.grid() allows you to specify the
'n' parameter to pretty(). This works for the x-axis in your example
(see below), but not the y-axis. For finer control, you need to
specify the locations explicitly (probably using panel.abline).
There probably should be one (maybe called "axis.tick"), but there
isn't yet. A workaround is to use scales$col (see below).
Not really. You could change the default panel function if you want.

Here's a modified version of your example:

# lattice version
lattice.options(default.theme = canonical.theme(color = T))
trellis.par.set("strip.border" = list(col="white"))
trellis.par.set("background" = list(col="white"))
trellis.par.set("axis.line" = list(col="white"))
trellis.par.set("strip.background" = list(col="darkgrey"))
trellis.par.set("superpose.symbol" = list(col = myColors, pch=16, cex=0.8))

library(latticeExtra)

p2 <-
    xyplot(value ~ x | condition2 + condition1,
           data=df, groups = variable,
           panel = function(x, y, ...) {
               panel.fill(grey(0.95), border="white")
               panel.grid(h=-10, v=-10,
                          col="white",
                          lty=1, lwd=1)
               panel.grid(h=-5, v=-5,
                          col="white",
                          lty=1, lwd=2.5)
               panel.superpose(x, y, ...)
           },
           as.table = TRUE,
           between = list(x = 0.1, y = 0.1),
           scales = list(col = "darkgrey"),
           auto.key =
           list(space = "right", title = "variable"))

print(useOuterStrips(p2))

-Deepayan