How to adjust the font style of tags with plot_annotation in figures assembled with patchwork?

Viewed 1724

I have a figure assembled with patchwork as follows:

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')

enter image description here

How can I change the font face of tags so that the letters a and b appear in bold face?

1 Answers

After browsing this page, I found that tags of all subfigures can be modified with & operator:

p1 + p2 + plot_annotation(tag_levels = 'a') &
    theme(plot.tag = element_text(face = 'bold'))

enter image description here

Related