格子 - 矩阵状条带

时间:2013-06-28 16:53:55

标签: r strip lattice wireframe

我正在尝试以类似矩阵的方式将条带添加到叠加的线框图中:

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)
)

问题: 有没有办法在左边的条带和cond2上只有cond1在顶部条带上只有一次显示在外边框? (就像矩阵一样)

提前致谢!

约瑟夫

1 个答案:

答案 0 :(得分:0)

在这种情况下,我认为这就像知道在不同的包中有这样的功能一样简单:

require(latticeExtra)
?useOuterStrips

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

(它并不像你描述的那样,但它非常接近,我认为在外部条带上只有“一个值”是不合理的,而通常的情况是在条件变量中有不同的级别。 )