'Combine multiple patchworks
I would like to combine multiple plots created by patchwork in another patchwork, i.e. nested patchwork plots.
Dummy plots
# packages
require(ggplot2)
require(patchwork)
# plots
gg_hist = ggplot(iris) +
geom_histogram(aes(x = Sepal.Length), color = 'white') +
theme_void()
gg_plot = ggplot(iris) +
geom_point(aes(y = Sepal.Length, x = Sepal.Width))
# patchwork 1
gg1 = gg2 = gg_hist +
gg_plot +
plot_layout(heights = c(1,5))
I would like to combine gg1 & gg2 with the patchwork package to lie next to each other, like in cowplot::plot_grid(gg1, gg2). However they are arranged wrongly. It looks like a bug. Can anyone help?
BUG?
# patchwork 2
Reduce('+', list(gg1, gg2))
gg1 + gg2
WORKS:
# cowplot
cowplot::plot_grid(gg1, gg2)
Package versions: cowplot_1.1.1 patchwork_1.1.1 ggplot2_3.3.5
Solution 1:[1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Stephan |

