我们希望使用patchwork更改标签的颜色和大小,但没有发生任何更改
library(ggplot2)
library(patchwork)
p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))
p3 <- ggplot(mtcars) + geom_bar(aes(gear)) + facet_wrap(~cyl)
# Add title, etc. to a patchwork
p1 + p2 + plot_annotation('This is a title', caption = 'made with patchwork')
# Change styling of patchwork elements
p1 + p2 +
plot_annotation(
title = 'This is a title',
caption = 'made with patchwork',
theme = theme(plot.title = element_text(size = 16,color="red"))
)
# Add tags to plots
p1 / (p2 | p3) +
plot_annotation(tag_levels = 'A',theme = theme(plot.tag = element_text(color = "red")))发布于 2021-08-20 07:27:18
通过网站上描述的'&‘synthax,它似乎工作得很好。
p1 / (p2 | p3) +
plot_annotation(tag_levels = 'A') &
theme(plot.tag = element_text(color = "red"))

https://stackoverflow.com/questions/68857890
复制相似问题