R Index.cond不会在晶格中重新排列面板
我遵循《R在行动》一书第389页的示例,在以下晶格图中排列历史面板: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
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中看到过这种解决方案。