我有多個ggplots并希望以矩形方式將它們排列在繪圖視窗中。下面是我的代碼
library(ggplot2)
library(ggpubr)
plot1 = ggplot(data.frame(x = 1:3, y = 4:6), aes(x = x, y = y)) geom_line()
plot2 = ggplot(data.frame(x = 1:3, y = 4:6), aes(x = x, y = y)) geom_line()
plot3 = ggplot(data.frame(x = 1:3, y = 4:6), aes(x = x, y = y)) geom_line()
ggarrange(plot1, plot2, plot3, ncol = 2, nrow = 2, align = 'h')
我得到了低于安排

我想知道第三個情節是否可以放在情節視窗的中間?
任何指標都會非常有幫助。
uj5u.com熱心網友回復:
library(patchwork)
design <-
"1122
1122
#33#
#33#"
plot1 plot2 plot3 plot_layout(design = design)

uj5u.com熱心網友回復:
我改編了來自
或者
wrap_plots(A = plot1, B = plot2, C = plot3, design = "AABB\n#CC#")

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/485494.html
