title: Title getting cut off using grid.arrange
body: <p>I built a function for quickly plotting a table with a lot of help from <a href="https://stackoverflow.com/a/11775211/2146894">this answer</a> from @baptiste.</p>
  
  <pre><code>plotTable&lt;-function(data, title=NULL, footnote=NULL, fontsize=9, plotIt=TRUE, show.rownames=TRUE){
    # Generic method to plot tabular data
  
    # Built the base table with/without row names
    if(show.rownames){
      table &lt;- tableGrob(data, theme=ttheme_default(
        core=list(fg_params=list(fontsize=fontsize)),
        colhead=list(fg_params=list(fontsize=fontsize)),
        rowhead=list(fg_params=list(fontsize=fontsize))))
    } else{
      table &lt;- tableGrob(data, theme=ttheme_default(
        core=list(fg_params=list(fontsize=fontsize)),
        colhead=list(fg_params=list(fontsize=fontsize)),
        rowhead=list(fg_params=list(fontsize=fontsize))), rows=NULL)
    }
  
    # Set the padding
    padding &lt;- unit(0.5,"line")
  
    # Add the title if it's not NULL
    if(!is.null(title)){
      title.grob &lt;- textGrob(title, gp=gpar(fontsize=fontsize+3))
      table &lt;- gtable_add_rows(table, heights = grobHeight(title.grob) + padding, pos = 0)
      table &lt;- gtable_add_grob(table, list(title.grob), t=1, l=1, r=ncol(table))
    }
  
    # Add the footnote if it's not NULL
    if(!is.null(footnote)){
      footnote.grob &lt;- textGrob(footnote, x=0, hjust=0, gp=gpar(fontsize=fontsize, fontface="italic"))
      table &lt;- gtable_add_rows(table, heights = grobHeight(footnote.grob)+ padding)
      table &lt;- gtable_add_grob(table, list(footnote.grob), t=nrow(table), l=1, r=ncol(table))
    }
  
    # Either plot it or return the grob
    if(plotIt) grid.arrange(table) else return(table)
  }
  </code></pre>
  
  <p>But sometimes my title is longer than the actual table and it's getting cut off.</p>
  
  <pre><code>libs &lt;- c("data.table", "grid", "gridExtra", "gtable")
  lapply(libs, library, character.only = TRUE)
  
  mytable &lt;- data.table(x=c(1,2,3), y=c(3,2,1))
  plotTable(mytable, title="Hello World")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/BIQUe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BIQUe.png" alt="the table"></a></p>
  
  <p>How do I fix this?</p>