假设我想把以下六个图合并成一个图。
library(ggplot2)
p1 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
p3 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
p4 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
p4 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
p5 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
p6 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
我使用Pachwork包来实现这个功能:
library(patchwork)
(p1 | p2 | p2 ) / (p4 | p5 | p6 ) +
plot_annotation(title = "Perceptual Domain", tag_levels = 'A') &
theme(plot.title = element_text(hjust = 0.5), plot.tag = element_text(size = 15, face = "bold"))
我想为上面三个图添加一个标题,为下面的三个图添加另一个标题。
如您所见,在此示例中我只能添加一个标题,但无法添加第二个。
有人可以帮助我并展示如何为下面的三个图添加第二个标题吗?