title: Saving a graph with ggsave after using ggplot_build and ggplot_gtable
body: <p>I am modifying a graph built with ggplot by altering the data produced by ggplot_build (for a reason similar to <a href="https://stackoverflow.com/questions/15367762/r-ggplot-empty-factor-level">Include space for missing factor level used in fill aesthetics in geom_boxplot</a>). As far as I understand the help I found on this topic, I should be able to save the result by applying ggplot_gtable and arrangeGrob before calling ggsave on the results (<a href="https://stackoverflow.com/questions/17059099/saving-grid-arrange-plot-to-file">Saving grid.arrange() plot to file</a>).</p>
  
  <p>However I obtain an error "plot should be a ggplot2 plot", also with this simple reproductible example:</p>
  
  <pre><code>require('ggplot2')
  require('gridExtra')
  df &lt;- data.frame(f1=factor(rbinom(100, 1, 0.45), label=c("m","w")), 
                    f2=factor(rbinom(100, 1, 0.45), label=c("young","old")),
                    boxthis=rnorm(100))
  g &lt;- ggplot(aes(y = boxthis, x = f2, fill = f1), data = df) + geom_boxplot()
  dd &lt;- ggplot_build(g)
  
  # Printing the graph works:
  print(arrangeGrob(ggplot_gtable(dd)))
  
  # Saving the graph doesn't:
  ggsave('test.png',arrangeGrob(ggplot_gtable(dd)))
  </code></pre>
  
  <p>Can anybody explain why this does not work ? Is there a way to use ggsave after modifying the data by using ggplot_build() ?</p>
  
  <p>(My version of the packages are gridExtra_0.9.1 and ggplot2_0.9.3.1)</p>