title: Adding a table to ggplot with gridExtra and annotation_custom() changes y-axis limits
body: <p>I tried adding a little summary table to a plot which I created with <code>ggplot2::ggplot()</code>. The table is added via <code>gridExtra::tableGrob()</code> to the saved ggplot object. </p>
  
  <p>My problem is that this seems to change the y-limits of my original plot.
  Is there a way to avoid that without having to specify the limits again via <code>ylim()</code>? </p>
  
  <p>Here is a minimal example for the problem using the ChickWeight dataset:</p>
  
  <pre><code># load packages
  require(ggplot2)
  require(gridExtra)
  
  # create plot
  plot1 = ggplot(data = ChickWeight, aes(x = Time, y = weight, color = Diet)) +
          stat_summary(fun.data = "mean_cl_boot", size = 1, alpha = .5) 
  plot1
  # create table to add to the plot
  sum_table = aggregate(ChickWeight$weight, 
                        by=list(ChickWeight$Diet), 
                        FUN = mean)
  names(sum_table) = c('Diet', 'Mean')
  sum_table = tableGrob(sum_table)
  
  # insert table into plot
  plot1 + annotation_custom(sum_table)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/kl76d.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kl76d.png" alt="ylim problem with annotation_custom()"></a></p>
  
  <p><strong>EDIT:</strong>
  I just figured out that it seems to be an issue with <code>stat_summary()</code>. When I use another geom/layer, then the limits stay as they were in the original plot. Another example for that:</p>
  
  <pre><code>plot2 = ggplot(data = ChickWeight, aes(x = Time, y = weight, color = Diet)) +
          geom_jitter() 
  plot2
  plot2 + annotation_custom(sum_table)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Cjv8r.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Cjv8r.png" alt="ylim problem with annotation_custom()"></a></p>