如何调整拼凑图形中plot_annotation标签的字体样式?
How to adjust the font style of tags with plot_annotation in figures assembled with patchwork?
我有一个用patchwork
组装的图如下:
library(ggplot2)
library(patchwork)
p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))
p1 + p2 + plot_annotation(tag_levels = 'a')
如何更改标签的字体,使字母 a
和 b
以粗体显示?
浏览this page后发现所有子图的标签都可以用&
操作符修改:
p1 + p2 + plot_annotation(tag_levels = 'a') &
theme(plot.tag = element_text(face = 'bold'))
我有一个用patchwork
组装的图如下:
library(ggplot2)
library(patchwork)
p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))
p1 + p2 + plot_annotation(tag_levels = 'a')
如何更改标签的字体,使字母 a
和 b
以粗体显示?
浏览this page后发现所有子图的标签都可以用&
操作符修改:
p1 + p2 + plot_annotation(tag_levels = 'a') &
theme(plot.tag = element_text(face = 'bold'))