Equalize size of plots placed in juxtaposition by grid.arrange


Equalize size of plots placed in juxtaposition by grid.arrange



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


geom_bar()


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?


plot.margin


plot.margin





simply use facet_grid instead of grid.arrange
– Jimbou
Jul 3 at 9:13



facet_grid


grid.arrange





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: stackoverflow.com/questions/38101512/…
– adibender
Jul 3 at 9:20





did you mean "equalize bar width" instead of "equalize size of plots"?
– adibender
Jul 3 at 9:21





Does it help if you combine the plots using patchwork: github.com/thomasp85/patchwork
– adibender
Jul 3 at 9:29





Give us some data. Then we can help you in more detail.
– Jimbou
Jul 3 at 9:38




1 Answer
1



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


patchwork






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages