title: R - cowplot: arrange png image and ggplot, using plot_grid
body: <p>I am trying to arrange a png image and a ggplot object side by side using <code>plot_grid</code> from cowplot package:</p>
  
  <pre><code>library(cowplot)
  library(tableHTML)
  
  sg &lt;- data.frame(start = c(0,5,10), 
                   end = c(10,20,30),
                   duration = c(10,15,20), 
                   row.names = c("A","B","C"))
  
  p1 &lt;- ggplot(sg)+
    geom_segment(aes(x=start, y=row_number(start), xend=end, yend=row_number(start)), 
                 size = 3) +
    scale_y_reverse(labels = NULL) +
    labs(y = "", x = "") +
    theme(aspect.ratio = 1/5)
  
  sg %&gt;%
    tableHTML() %&gt;%
    add_theme("scientific") %&gt;%
    tableHTML_to_image(file = "image2.png", zoom = 2)
  
  p2 &lt;- ggdraw() + draw_image("image2.png", scale = 0.7)
  
  plot_grid(p2, p1, ncol = 2, scale = c(0.9,1), rel_widths = c(1, 2))
  </code></pre>
  
  <p>However, in the resulting plot I find it difficult to arrange the two plots as required.</p>
  
  <p><a href="https://i.stack.imgur.com/KelZL.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/KelZL.jpg" alt="see here"></a></p>
  
  <p>Ideally, I would like the lower border of the table image to be in line with the x-axis of the graph. I would also like the two items to be closer to each other.</p>
  
  <p>I have tried modifying the scale of plot p2, the zoom argument in the <code>tableHTML_to_image</code> command, or the scale, rel_widths, align and axis arguments within the <code>plot_grid</code> command, but none of it really gets me closer to the desired output.</p>
  
  <p>I also read here: 
  <a href="https://stackoverflow.com/questions/53852428/insert-image-png-ggplot2-cowplot">Insert Image/PNG ggplot2 - Cowplot</a>
  but that's only for the adding an image inside an existing plot, not beside it.</p>
  
  <p>While <code>plot_grid</code> works fine when arranging two ggplots, I can't get it right with an image and a ggplot.</p>