Margins between plots in grid.arrange

拟墨画扇 提交于 2019-12-01 00:24:28

问题


I dont seem to be able to find a solution as to how to increase the space between two plots with grid.arrange. I find no clue as to how to proceed. I dont want to change the size of the plots or anything like that.

grid.arrange(plot1, plot2, ncol=2)

(The stuff below was added later):

This is the code that I have:

x11()

cs <- grid.arrange(arrangeGrob(b, a, ncol=2, top = textGrob(
                    "B", vjust = 0.5, hjust = 19.5, gp = gpar(
                     fontface = "bold", cex = 1.5)),
                     left = textGrob(~ Delta * "SCR (p - d)" ~ mu * 'S', 
                     gp=gpar(fontsize=18), rot = 90, vjust = 1)))
soc_sph <- grid.arrange(arrangeGrob(p, g, ncol=2, top = textGrob(
                     "A", vjust = 0.5, hjust = 19.5, gp = gpar(
                     fontface = "bold", cex = 1.5)),
                     left = textGrob(~ Delta * "SCR (p - d)" ~ mu * 'S', 
                     gp=gpar(fontsize=18), rot = 90, vjust = 1)))

grid.arrange(soc_sph, cs, ncol=2)

So it is in this last grid.arrange, the space between soc_sph and cs that is to be increased.


回答1:


the standard way is to change the plot margins,

pl = replicate(3, ggplot(), FALSE)
grid.arrange(grobs = pl)  # default settings

margin = theme(plot.margin = unit(c(2,2,2,2), "cm"))
grid.arrange(grobs = lapply(pl, "+", margin))



来源:https://stackoverflow.com/questions/39508304/margins-between-plots-in-grid-arrange

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!