SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
xyplot of function only shows diagonal plots [ Reply ]
By: Hatcher Chalkley on 2010-06-26 17:19
[forum:3042]
I expected this script to show nine panels, each with a plot of the function. But only the diagonal panels have content.
Executing > print(trel_1) shows what I expected in the upper left corner.
I have searched the documentation, but found no answer. What am I missing?

--- simple.R ---

require("lattice")

f <- function(x,a,b){return( a * sin(x)+ b)}
trellis.par.set(theme = canonical.theme("Windows"))
x <- seq(-4,4, by=0.1)
# case 1x1
a <- c( 1 )
b <- c( 3 )
trel_1 <- xyplot(f(x,a,b) ~ x | a * b, , type = "l",
main = "1x1", ylab = "f(x)", xlab = "x",
xlim = c(-6,6), ylim = c(-6,6), )
# case 3x3
a <- c(1,2,3)
b <- c(1,2,3)
trel_3 <- xyplot(f(x,a,b) ~ x | a * b, , type = "l",
main = "3x3", ylab = "f(x)", xlab = "x",
xlim = c(-6,6), ylim = c(-6,6), )

print(trel_3)

--- end of simple.R ---

Thanks to:
Vienna University of Economics and Business Powered By FusionForge