【发布时间】:2021-01-15 09:36:16
【问题描述】:
是否可以在“主”标题下方和情节标题上方使用拼凑而成的图例?
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")
【问题讨论】: