Add subtitle below the panel

Hi together,

I could not find anything about changing the relative placement of the subtitle. Specifically, I would like to place it BELOW the panel while being able to add a proper caption which is right-aligned. Is this possible or do I have to add a textbox manually?

Thanks!

There's no option within ggplot2 that I could find regarding setting the subtitle position via theme(), etc. You don't have to add a textbox manually, but you can add your subtitle text as a tag, and set the placement to the bottom of the chart. The caption is added afterwards via patchwork to ensure that the caption is positioned below the subtitle.

Option 1 - Caption below subtitle

library("ggplot2")
library("patchwork")

g1 <- ggplot(mtcars, aes(hp, mpg)) +
  geom_point() +
  labs(title = "Title",
    tag = "Subtitle") +
  theme(plot.title = element_text(hjust = 0.5),
    plot.tag.position = "bottom")

g1 + plot_annotation(caption = "caption")

Rplot
Option 2 - Caption above subtitle

g2 <- ggplot(mtcars, aes(hp, mpg)) +
  geom_point() +
  labs(title = "Title",
    tag = "Subtitle",
    caption = "caption") +
  theme(plot.title = element_text(hjust = 0.5),
    plot.tag.position = "bottom")
    
g2

Rplot01

1 Like

Oh, did not think about manipulating the tag element - that's a grerat idea (at least as long I don't need a tag). And the adding it via patchwork is a nice trick, thank you very much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.