I am trying to reduce horizontal space between figures in grid.arrange
. I want to minimize white space as much as possible. The component figures are produced by the gplot
function in the sna package, which uses base graphics. This function seems to produce plots with wide left and right margins (because the plot area is approximately square, in a rectangular plotting space there is extra space on these margins). I have tried reducing the plot margins to 0 in par, but this does not seem to have any effect. I can I reduce the component plot margins/whitespace to a minimum in this example?
library(sna)
library(gridExtra)
library(gridGraphics)
library(ggplotify)
par(mar = c(7,0,1,0))
m <- list()
for(i in 1:4){
gplot(rgraph(10, tprob=.3))
grid.echo()
m[[i]] <- grid.grab()
}
#grid.arrange(m, ncol = 2)
#lapply(m, class)
grid.arrange(m[[1]], m[[2]], m[[3]], m[[4]], ncol = 2)
I have also tried increasing the plot width and height itself with:
options(repr.plot.width=10, repr.plot.height=10)
but this does not seem to have any effect.