Question

I'm trying to add strips to a superimposed wireframe-plot in a matrix-like fashion:

library(lattice)
g <- expand.grid(x = 1:10, y = 5:15, gr = 1:2)
cond1 <- c(rep(1,2*dim(g)[1]),rep(2,2*dim(g)[1]))
cond2 <- c(rep(1,dim(g)[1]),rep(2,dim(g)[1]),rep(1,dim(g)[1]),rep(2,dim(g)[1]))

g$z <- log((g$x^g$gr + g$y^2) * g$gr)

g <- cbind(rbind(g,g,g,g),cond1,cond2)
wireframe(z ~ x * y | cond1+cond2, data = g, groups = gr,
          scales = list(arrows = FALSE),
          strip.left=T,
          strip=T,
          drape = TRUE, colorkey = F,
          screen = list(z = 30, x = -60)
)

Question: Is there a way to have exclusively cond1 on the left strip and cond2 on the top strip and only once displayed at the outer borders? (Just like a matrix)

Thanks in advance!

Joseph

Was it helpful?

Solution

In this case I think it is as simple as knowing there is such a function in a different package:

require(latticeExtra)
?useOuterStrips

 wr <- wireframe(z ~ x * y | cond1+cond2, data = g, groups = gr,
 useOuterStrips(wr)

(It's not quite as you described but it's pretty close, and I don't think it makes sense to have "only one value" on the outer strips, when the usual case is to have different levels in the conditioning variables.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top