是否可以使用拼凑而成的“主要”标题下方和情节标题上方的图例?
library(ggplot2)
library(patchwork)
p1 <- ggplot(mtcars, aes(disp, wt, color = factor(gear))) +
geom_point() +
labs(title = "first plot title")
p2 <- ggplot(mtcars, aes(drat, qsec, color = factor(gear))) +
geom_point() +
labs(title = "second plot title")
(p1+p2) +
plot_layout(guides = "collect") +
plot_annotation(title = "main title") &
theme(legend.position = "top")