If you are using ggplot
, you might also consider using the patchwork
package for this to make it easy. For example:
Step 1: Create all your figures and assign them to objects (e.g., fig1
, fig2
etc.). For example:
fig1 <- ggplot(data = myData, mapping = aes(x = x, y = y) +
geom_point()
#...etc.
Step 2: To create the layout to specified:
library(patchwork)
(fig1 + fig2 + fig3) / (fig4 + fig5) / (fig6 + fig7)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…