title: ggplot2: Fix axis height/width when combining plots
body: <pre><code>library(ggplot2)
  library(gridExtra)
  
  df1 &lt;- data.frame(x=c("A1","A2","A3","A4"),something=c(10,18,24,32))
  df2 &lt;- data.frame(x=c("C1","C2","C3","C4"),somethingelse=c(10543,182334,242334,32255))
  
  
  p1 &lt;- ggplot(df1,aes(x,something))+
    geom_bar(stat="identity")
  p2 &lt;- ggplot(df2,aes(x,somethingelse))+
    geom_bar(stat="identity")
  
  
  png("test.png",height=8,width=6,res=120,units="cm")
  gridExtra::grid.arrange(p1,p2,heights=grid::unit(c(4,4),"cm"))
  dev.off()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/7WQVz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7WQVz.png" alt="enter image description here"></a></p>
  
  <p>When I manually combine two or more plots like above, how can I fix the y-axis widths to be the same, so that my bars across all plots (A1-C1,A2-C2,..) align? Is there some way to calculate max y label width and apply that width to the y-axis of all plots? And no, facets are not something I want in this particular case.</p>