【发布时间】:2014-07-07 14:02:18
【问题描述】:
我正在尝试复制以下代码,但直方图被替换为ggplot 调用。所以,这行得通:
layout(matrix(c(1, 2, 3, 4, 4, 3, 4, 4, 5), ncol=3))
hist(1:20)
hist(1:40)
hist(1:60)
hist(1:80)
hist(1:90)
这不是(每个 ggplot 创建一个新的全尺寸图像而不是布局的一部分):
layout(matrix(c(1, 2, 3, 4, 4, 3, 4, 4, 5), ncol=3))
ggplot(data.frame(x=1:20)) + stat_bin(aes(x=x))
ggplot(data.frame(x=1:40)) + stat_bin(aes(x=x))
ggplot(data.frame(x=1:60)) + stat_bin(aes(x=x))
ggplot(data.frame(x=1:80)) + stat_bin(aes(x=x))
ggplot(data.frame(x=1:90)) + stat_bin(aes(x=x))
第一段代码产生以下布局:
我如何使用ggplot 以与第一个layout 调用相同的方式排列图?
【问题讨论】: