【发布时间】:2017-04-14 03:04:36
【问题描述】:
我想使用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
有什么想法吗?
【问题讨论】:
标签: r list ggplot2 gridextra r-grid