我有以下簡化的用例。基本上我有一些GGPLOT2情節,我想與其他正在使用的基本圖形庫產生的結合plot.new()
等:如何通過arrangeGrob獲取基本圖形plot.new以與其他人結合?
p1 <- generate_ggplot1(...)
p2 <- generate_ggplot2(...)
p3 <- generate_ggplot3(...)
# how to get hold of the plot output and make it available as
# p4 for arrangeGrob?
plot.new()
...
final <- gridExtra::arrangeGrob(p1, p2, p3, p4, layout_matrix = rbind(c(1,2), c(3,4)), widths=c(7,7), heights=c(7,7))
ggplot2::ggsave(filename=output.file,plot=final,width=14,height=14)
哪些選項有做到這一點?從此改寫P4分別是原生ggplot2
我不知道是否有可能與'gridextra',但檢查'gridbase'; [在R數字窗口中結合base和ggplot圖形](https://stackoverflow.com/questions/14124373/combine-base-and-ggplot-graphics-in-r-figure-window/14125565#14125565),[生成的圖表通過'plot'和'ggplot'並排](https://stackoverflow.com/questions/13021863/plots-generated-by-plot-and-ggplot-side-by-side) – Henrik