mt1022
mt1022

Reputation: 17299

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

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?

Upvotes: 10

Views: 6107

Answers (1)

mt1022
mt1022

Reputation: 17299

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

Upvotes: 18

Related Questions