patchwork
patchwork copied to clipboard
Add legend between patchwork main title and plot titles
Relevant post at SO:
- https://stackoverflow.com/q/65733641/680068
I submitted the answer (also posted below) using cowplot::get_legend, is there a way of doing this without cowplot?
Solution:
# get the legend
l <- cowplot::get_legend(p1 + theme(legend.position = "top"))
(cowplot::plot_grid(l) / (p1 + p2)) +
plot_layout(heights = unit(c(1, 5), "cm")) +
plot_annotation(title = "main title") &
theme(legend.position = "none")
