title: Altering ggplot2 plot using ggplot_build and use it in plot_grid
body: <p>I want to alter a <code>ggplot2</code> plot in R using the <code>ggplot_build</code> and <code>ggplot_gtable</code> functions and use it afterwards in a <code>plot_grid</code>.</p>
  
  <p>Example code to make the plot:</p>
  
  <pre><code>library(ggplot2) 
  library(cowplot)
  
  p1 &lt;- ggplot(iris) +
    aes(x = Sepal.Length, y = Sepal.Width, colour = Species) +
    geom_point()
  p2 &lt;- ggplot(iris) +
    aes(x = Petal.Length, y = Petal.Width, colour = Species) +
    geom_point()
  
  plot_grid(p1, p2)
  </code></pre>
  
  <p>Then I change p1 using ggplot_build and ggplot_gtable:</p>
  
  <pre><code>q1 &lt;- ggplot_build(p1)
  q1$data[[1]]$colour &lt;- "black"
  q1 &lt;- ggplot_gtable(q1)
  </code></pre>
  
  <p><code>plot(q1)</code> plots the plot that I want but I can not use it in <code>plot_grid</code> with <code>plot_grid(q1, p2)</code>. How can I solve this?</p>
  
  <p>Edit: Code should have indeed worked. After a complete R restart everything worked as expected. Should have tried this first, apologies!</p>