# NOT RUN {
types.plain <- c("p", "l", "o", "r", "g", "s", "S", "h", "a", "smooth")
types.horiz <- c("s", "S", "h", "a", "smooth")
horiz <- rep(c(FALSE, TRUE), c(length(types.plain), length(types.horiz)))
types <- c(types.plain, types.horiz)
x <- sample(seq(-10, 10, length.out = 15), 30, TRUE)
y <- x + 0.25 * (x + 1)^2 + rnorm(length(x), sd = 5)
xyplot(y ~ x | gl(1, length(types)),
xlab = "type",
ylab = list(c("horizontal=TRUE", "horizontal=FALSE"), y = c(1/6, 4/6)),
as.table = TRUE, layout = c(5, 3),
between = list(y = c(0, 1)),
strip = function(...) {
panel.fill(trellis.par.get("strip.background")$col[1])
type <- types[panel.number()]
grid::grid.text(label = sprintf('"%s"', type),
x = 0.5, y = 0.5)
grid::grid.rect()
},
scales = list(alternating = c(0, 2), tck = c(0, 0.7), draw = FALSE),
par.settings =
list(layout.widths = list(strip.left = c(1, 0, 0, 0, 0))),
panel = function(...) {
type <- types[panel.number()]
horizontal <- horiz[panel.number()]
panel.xyplot(...,
type = type,
horizontal = horizontal)
})[rep(1, length(types))]
# }
Run the code above in your browser using DataLab