title: Multiple plots side by side - How to make all plots the same widths?
body: <p>I am just arranging three ggplots so that they appear side by side in the saved png. Thereby I followed the helpful clue of <a href="https://stackoverflow.com/a/20502085/6574038">this answer</a>. For better clearness I display only the legend of the rightmost plot. Logically now there has to be specified a greater width to the rightmost plot because of the legend. With <code>scales::arrangeGrob()</code> we can achieve this, e.g. <code>c(600, 600, 750)</code>. </p>
  
  <pre><code>library(ggplot2)
  economics$long &lt;- with(economics, ifelse(uempmed &gt; 8.61, 1, 0))
  p &lt;- ggplot(economics[economics$date &lt; "1979-01-01", ], 
              aes(date, unemploy, color = long)) + 
    geom_line() + theme(legend.position="none")
  q &lt;- ggplot(economics[economics$date &lt; "1991-01-01", ], 
              aes(date, unemploy, color = long)) + 
    geom_line() + theme(legend.position="none")
  r &lt;- ggplot(economics[economics$date &lt; "2003-01-01", ], 
              aes(date, unemploy, color = long)) +
    geom_line()
  
  l &lt;- list(p, q, r)
  
  library(gridExtra)
  ggsave("test.png", 
         arrangeGrob(grobs = l, nrow = 1, ncol = 3, 
                     widths = c(600, 600, 750), heights = NULL, 
                     padding = unit(0.5, "line")),
         width = 18, height = 9, units = "cm", dpi = 600,
         scale = 1.5)
  </code></pre>
  
  <p>I'm sure by trial and error I could adjust the rightmost plot till it fits. The actual problem is, that the widths of the middle and the leftmost plot do not match despite of the same values of <code>600</code>, which is really annoying:</p>
  
  <p><a href="https://i.stack.imgur.com/2xFVf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2xFVf.png" alt="enter image description here"></a></p>
  
  <p>Does anybody know how to make all plots the same widths?</p>