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
Add a plot to an existing patchwork object #353
Comments
To understand correctly, you wan't your plot to be added into the returned patchwork so that it inherits the theme, caption etc? |
Hi @thomasp85 thanks for the follow-up. Sharing a visual example. The first plot is a returned patchwork and the second one is what I'd like to achieve: adding/appending a new ggplot2 object to an existing patchwork with a customized grid. |
I'm afraid there is really no "non-hacky" way of doing this. You could add your plot with try something like: p <- fun_returning_patchwork()
my_plot <- fun_creating_my_plot()
p + my_plot + plot_layout(design = c("
AB
GG
CD
EF
")) and see if it works as expected |
That was a great hint Thomas, but wasn't exactly what I was expecting. So running your example, I was getting something like But that's because each of the previous plots was already a patchwork object! So, setting Additional tests: I tried setting up |
Hi Thomas and community.
I've been using patchwork for years now and it's amazingly useful and easy to use. But today I'd like to ask how can I add a ggplot2 object to an already existing patchwork object. The original patchwork object comes from a function that returns a plot with 8 plots in 4 rows and 2 columns. It contains a title, captions, and an overall theme added over it. But now I'd like to add a new wide plot under 1 and 2, over 3 and 4. It's easy to achieve from scratch, but given I have an object that another library provides and has been already patched together, how can I do this?
Thanks a lot for all your contributions to the R community!
The text was updated successfully, but these errors were encountered: