packet.panel.page <- function(n)
{
## returns a function that when used as the 'packet.panel'
## argument in print.trellis plots page number 'n' only
function(layout, page, ...) {
stopifnot(layout[3] == 1)
packet.panel.default(layout = layout, page = n, ...)
}
}
data(mtcars)
HP <- equal.count(mtcars$hp, 6)
p <-
xyplot(mpg ~ disp | HP * factor(cyl),
mtcars, layout = c(0, 6, 1))
print(p, packet.panel = packet.panel.page(1))
print(p, packet.panel = packet.panel.page(2))
Run the code above in your browser using DataLab