Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R Index.cond不会在晶格中重新排列面板_R_Graphics_Lattice - Fatal编程技术网

R Index.cond不会在晶格中重新排列面板

R Index.cond不会在晶格中重新排列面板,r,graphics,lattice,R,Graphics,Lattice,我遵循《R在行动》一书第389页的示例,在以下晶格图中排列历史面板: library(lattice) graph1 <- histogram(~ height | voice.part, data = singer, main = "Heights of Choral Singers by Voice Part") graph2 <- densityplot(~ height, data = singer, group = voice.par

我遵循《R在行动》一书第389页的示例,在以下晶格图中排列历史面板:

library(lattice)
graph1 <- histogram(~ height | voice.part, data = singer,
                    main = "Heights of Choral Singers by Voice Part")
graph2 <- densityplot(~ height, data = singer, group = voice.part,
                      plot.points = FALSE, auto.key = list(columns = 4))
plot(graph1, position=c(0, .3, 1, 1))
plot(graph2, position=c(0, 0, 1, .3), newpage = FALSE)
但图中的顺序没有改变。有人能帮我吗? 我还注意到
index.cond
不在
绘图

index.cond的帮助下,因为
xyplot
中描述的其他参数要么传递给创建“网格”对象的函数,要么传递给
更新
方法。所以,在这种情况下,你可以

通过将“index.cond”传递到直方图来创建“graph1”:

histogram(~ height | voice.part, data = singer, 
          main = "Heights of Choral Singers by Voice Part", 
          index.cond = list(c(2, 4, 6, 8, 1, 3, 5, 7)))
,使用
更新

update(graph1, index.cond = list(c(2, 4, 6, 8, 1, 3, 5, 7)))
或者使用
“[”

中描述的其他参数一样,“index.cond”?xyplot
要么传递给创建“网格”对象的函数,要么传递给
update
方法

通过将“index.cond”传递到直方图来创建“graph1”:

histogram(~ height | voice.part, data = singer, 
          main = "Heights of Choral Singers by Voice Part", 
          index.cond = list(c(2, 4, 6, 8, 1, 3, 5, 7)))
,使用
更新

update(graph1, index.cond = list(c(2, 4, 6, 8, 1, 3, 5, 7)))
或者使用
“[”


“index.cond”似乎是
?update.grillis
--
更新(graph1,position=c(0.3,1,1),index.cond=list(c(2,4,6,8,1,3,5,7))
真的很感谢。这完美地解决了我的问题。@alexis_laz:这似乎值得一次“真正的”讨论回答。处理晶格面板参数可能很棘手,我不记得在SO或Rhelp上看到过这种解决方案。“index.cond”似乎是
?update.grills
--
update(graph1,position=c(0.3,1,1),index.cond=list(c(2,4,6,8,1,3,5,7))的参数
非常感谢。这完美地解决了我的问题。@alexis_laz:这似乎值得一个“真实”的答案。处理晶格面板参数可能很棘手,我不记得在SO或Rhelp中看到过这种解决方案。