0

I gathered three geom_bar() plots in one plot by grid.arrange:

enter image description here

I removed the y axis of the two right plots (Q2,Q3) and kept the y axis of Q1 as a common axis. Subsequently, I change plot.margin a little bit to obtain a continuous x axis. Although this worked fine, it bugs me that the leftmost plot is smaller than the remaining two plots. I highlighted the difference in size by plotting the y axis again. I tried to fix this by changing plot.margin but without success. Is there any way to equalize the size of the three plots?

Random Cotija
  • 613
  • 1
  • 10
  • 26
00schneider
  • 698
  • 9
  • 21
  • 1
    simply use `facet_grid` instead of `grid.arrange` – Roman Jul 03 '18 at 09:13
  • The plots do have the same width, but the bars on the left have smaller width because there are 3 instead of 2. The solution here might help: https://stackoverflow.com/questions/38101512/the-same-width-of-the-bars-in-geom-barposition-dodge – adibender Jul 03 '18 at 09:20
  • did you mean "equalize bar width" instead of "equalize size of plots"? – adibender Jul 03 '18 at 09:21
  • the plots do have the same width in total, but the leftmost plot area where the bars are located is smaller than the others because the y axis text crops some width/space. I do not mean the size of the bars themselves. – 00schneider Jul 03 '18 at 09:24
  • 1
    Does it help if you combine the plots using patchwork: https://github.com/thomasp85/patchwork – adibender Jul 03 '18 at 09:29
  • 1
    Give us some data. Then we can help you in more detail. – Roman Jul 03 '18 at 09:38
  • Welcome to StackOverflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – Axeman Jul 03 '18 at 09:48
  • patchwork actually did the job. Thank you for the suggestion! – 00schneider Jul 03 '18 at 10:09

1 Answers1

0

The package patchwork (https://github.com/thomasp85/patchwork) automatically balances the size of the plots while aggregating the plots

00schneider
  • 698
  • 9
  • 21