2016-09-15 354 views
5

我似乎無法找到解決方案,以便如何使用grid.arrange來增加兩個圖之間的空間。我不知道如何進行。我不想改變劇情的大小或類似的東西。 (下面的東西,後來加入)grid.arrange之間的邊界之間的邊距

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

這是我的代碼:

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) 

因此,它是在這最後的網格。安排,soc_sph和cs之間的空間將增加。

+0

的[減少grid.arrange地塊之間空間](HTTP可能重複:// stackoverflow.com/questions/13299496/reduce-space-between-grid-arrange-plots) – Axeman

回答

8

的標準方法是改變情節邊距,

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

enter image description here

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

enter image description here

+0

如何將灰色背景添加到白色的地塊? (如上所述的反向配色方案)。我試過這個:''https:// pastebin.com/wgdUrrn0''我應該問一個新問題嗎? – PatrickT