我希望使用grid.arrange
从列表中创建ggplot2
绘图的多面板显示,但要先按列排列,然后再按行排列。
gg_list1 <- list(qplot(mpg, disp, data = mtcars),
qplot(hp, wt, data = mtcars),
qplot(qsec, wt, data = mtcars))
gg_list2 <- list(qplot(mpg, disp, data = mtcars),
qplot(hp, wt, data = mtcars),
qplot(qsec, wt, data = mtcars))
我知道我能做到这件事:
do.call(grid.arrange,c(gg_list1,gg_list2 , ncol = 2, nrow = 3))
但它会先从左到右填充,然后再从上到下。
我尝试过这样:
do.call(grid.arrange, c(gg_list1, arrangeGrob(gg_list2, nrow = 3), ncol = 2))
但是出现错误:Error: length(widths) == ncol is not TRUE
有什么想法吗?
grob =
参数仍然是从左到右填充,然后再从上到下,顺便说一句,但是也许你已经知道了?你的第二个例子成功了!非常感谢 - 我已经在尝试解决这个问题了过去4小时,不是开玩笑的。 - Bononoas.table = FALSE
以按列填充;我会进行编辑。 - alistaire