-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using align='hv' in plot_grid ignores defined margins #40
Comments
There's an ugly workaround, but it's quite complicated and I don't have the time right now to work it out in detail. In a nutshell, you need to prepare two graphs without the x-axis tick labels and one that only contains the labels, and then stitch them together. You can obtain a graph with only the labels by making the full plot, converting to a gtable, and extracting the relevant row from the table. My lab uses these kinds of techniques a lot, and at some point I'll hopefully write code that makes it easier, but I don't have it right now. |
Just wanted to chime in here that I'd be interested in this as well. It relates to issue #49. I've tried doing it as you suggest above, but my grob knowledge is miniscule, and I was unable to get it working... Thanks for any time you might have to push out relevant code! |
I found a quick and dirty solution without grobbing by altering the margins for each individual plot before combining with
I doubt this is the optimal way but it did the trick for me! |
Altering margins and mutagenizing the grob didn't work for me. I'm making some marginal histograms such that they're on the same range. I ended up making each aligned plot, and stacked them on top of each other. This of course requires Here's in case it's of use:
|
The development version of cowplot contains a function
And the same with density plots, which make more sense if you want to distinguish between the two colors:
|
I'm having an issue trying to reduce the margins around my plots in plot_grid.
Using
align='hv'
perfectly aligns and scales my axes but leaves unwanted whitespace between plots, like so:Whereas defining margins within each plot reduces the whitespace as desired, but leaves the y axes misaligned due to their different sizes, like so:
I've included a reproducible example below.
Thanks in advance for any help on this matter -- I appreciate the work you're doing with cowplot.
The text was updated successfully, but these errors were encountered: