title: Background of grid.arrange
body: <p>I have made a plot like the one described by the code below resulting in the posted image. I can not figure out how to set the entire background to the same "grey80"-color I have used when defining the subplots. Ie. I want to color the white areas between the plots and on the sides of the legend in the same color.
  Is this possible to achieve, perhaps with some fancy gridgrob-magic?</p>
  
  <p>This question is similar to <a href="https://stackoverflow.com/questions/13691415/change-the-background-color-of-grid-arrange-output">change the background color of grid.arrange output</a> but I would like a solution without using the png() function, if possible</p>
  
  <pre><code>library(ggplot2)
  library(gridExtra)
  library(ggthemes)
  library(grid)
  
  p1 &lt;- ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width,
                         colour = Species)) + 
    ggtitle('Sepal') + 
    geom_point() + theme_bw() + 
    theme(rect = element_rect(fill = 'grey80'))
  
  
  p2 &lt;- ggplot(iris, aes(x = Petal.Length, y = Petal.Width,
                         colour = Species)) + 
    ggtitle('Petal') + 
    geom_point() + theme_bw() + 
    theme(rect = element_rect(fill = 'grey80'))
  
  grid_arrange_shared_legend &lt;- function(...) {
    plots &lt;- list(...)
    g &lt;- ggplotGrob(plots[[1]] + theme(legend.position = "bottom"))$grobs
    legend &lt;- g[[which(sapply(g, function(x) x$name) == "guide-box")]]
    lheight &lt;- sum(legend$height)
    grid.arrange(
      do.call(arrangeGrob, lapply(plots, function(x)
        x + theme(legend.position="none"))),
      legend,
      ncol = 1,
      heights = unit.c(unit(1, "npc") - lheight, lheight))
  }
  
  grid_arrange_shared_legend(p1,p2)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/8Fi8b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Fi8b.png" alt="Grid arrange plot"></a></p>