Index.cond 不重新排列格子中的面板
Index.cond does not rearrange the panels in lattice
我正在按照书本 "R in action" P389 示例在以下格图中排列 hist 面板:
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
来改变图表的顺序,比如
plot(graph1, position = c(0, .3, 1, 1),
index.cond = list(c(2, 4, 6, 8, 1, 3, 5, 7)))
但图中的顺序没有改变。谁能帮我这个?
我还注意到 index.cond
不在 ?plot
的帮助下
"index.cond",因为 ?xyplot
中描述的其他参数要么传递给创建 "trellis" 对象的函数,要么传递给 update
方法。所以,在这种情况下,你可以
通过将 "index.cond" 传递给 histogram
创建 "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
:
update(graph1, index.cond = list(c(2, 4, 6, 8, 1, 3, 5, 7)))
或使用"["
:
graph1[c(2, 4, 6, 8, 1, 3, 5, 7)]
我正在按照书本 "R in action" P389 示例在以下格图中排列 hist 面板:
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
来改变图表的顺序,比如
plot(graph1, position = c(0, .3, 1, 1),
index.cond = list(c(2, 4, 6, 8, 1, 3, 5, 7)))
但图中的顺序没有改变。谁能帮我这个?
我还注意到 index.cond
不在 ?plot
"index.cond",因为 ?xyplot
中描述的其他参数要么传递给创建 "trellis" 对象的函数,要么传递给 update
方法。所以,在这种情况下,你可以
通过将 "index.cond" 传递给 histogram
创建 "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
:
update(graph1, index.cond = list(c(2, 4, 6, 8, 1, 3, 5, 7)))
或使用"["
:
graph1[c(2, 4, 6, 8, 1, 3, 5, 7)]