useOuterStrips <-
function(x,
strip = strip.default,
strip.left = strip.custom(horizontal = FALSE),
strip.lines = 1,
strip.left.lines = strip.lines)
{
dimx <- dim(x)
stopifnot(inherits(x, "trellis"))
stopifnot(length(dimx) == 2)
opar <- if (is.null(x$par.settings)) list() else x$par.settings
par.settings <-
modifyList(opar,
list(layout.heights =
if (x$as.table) list(strip = c(strip.lines,
rep(0, dimx[2]-1)))
else list(strip = c(rep(0, dimx[2]-1), 1)),
layout.widths =
list(strip.left = c(strip.left.lines, rep(0,
dimx[1]-1)))))
if (is.character(strip))
strip <- get(strip)
if (is.logical(strip) && strip)
strip <- strip.default
new.strip <-
if (is.function(strip))
{
top.row <- if (x$as.table) 1 else nrow(trellis.currentLayout())
function(which.given, which.panel, var.name, ...) {
if (which.given == 1 && current.row() == top.row)
strip(which.given = 1,
which.panel = which.panel[1],
var.name = var.name[1],
...)
}
}
else strip
if (is.character(strip.left))
strip.left <- get(strip.left)
if (is.logical(strip.left) && strip.left)
strip.left <- strip.custom(horizontal = FALSE)
new.strip.left <-
if (is.function(strip.left))
{
function(which.given, which.panel, var.name, ...) {
if (which.given == 2 && current.column() == 1)
strip.left(which.given = 1,
which.panel = which.panel[2],
var.name = var.name[2],
...)
}
}
else strip.left
update(x,
par.settings = par.settings,
strip = new.strip,
strip.left = new.strip.left,
par.strip.text = list(lines = 0.5),
layout = dimx)
}
I've included a short example. I know the example looks odd without axis
lines, but in my more complicated wireframe plots I think the axis
lines are just extra clutter, so I'd like them to disappear.
Thanks,
Tyler
library(lattice)
my.trellis.pars <- trellis.par.get("axis.line")
my.trellis.pars$lwd = 0
You should use
my.trellis.pars$col = "transparent"
(lwd=0 is not what you think it is).
-Deepayan
mtcars$HP <- equal.count(mtcars$hp)
trellis.par.set("axis.line", my.trellis.pars)
xyplot(mpg ~ disp | HP + factor(cyl), mtcars)
useOuterStrips(xyplot(mpg ~ disp | HP + factor(cyl), mtcars))
--
The purpose of models is not to fit the data but to sharpen the
questions. ? ? ? ? ? ? ? ? ? ? ? ? ? ? --Samuel Karlin