在此示例中,我为三个图添加了边框:
library(ggplot2)
library(patchwork)
theme_border <- theme_gray() +
theme(plot.background = element_rect(fill = NA, colour = 'black',
size = 1, linetype = "dashed"))
ggplot() +
ggplot() +
ggplot() +
plot_layout(ncol=1, guides = "collect") +
plot_annotation(title = "Pred Sp", theme = theme_border)
创建于 2024-04-18,使用 reprex v2.0.2
剧情标题在里面。是否可以将其放置在边界之外?另外,可以画圆角边框吗?
我们可以使用
patchwork::wrap_elements()
创建带边框的图,然后添加标题。
我不知道如何使边框角变圆(简单)。
library(ggplot2)
library(patchwork)
theme_border <- theme_gray() +
theme(plot.background = element_rect(fill = NA, colour = 'black',
linewidth= 1, linetype = "dashed"))
wrap_elements(ggplot() +
ggplot() +
ggplot() +
plot_layout(ncol=1, guides = "collect")+
plot_annotation(theme = theme_border)) +
plot_annotation(title = "Pred Sp")
创建于 2024-04-18,使用 reprex v2.0.2