Changing Position of Plot Captions

I have created the following plot using ggplot2.

Screen Shot 2021-07-02 at 10.01.24 AM

I would like to move the caption so that it is under the legend. I have tried using the following code:

theme(plot.caption = element_text(hjust = 1))

But it seems like the current position is the "most right" that the caption can go using this code. Any tips in moving the caption further right?

Thanks!

1 Like

Try something like this:

library(tidyverse)
ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = Species)) +
  geom_point() +
  labs(caption = "caption text") +
  theme(plot.caption.position = "plot")

Extra info:

plot.caption.position
Alignment of the plot title/subtitle and caption. The setting for plot.title.position applies to both the title and the subtitle. A value of "panel" (the default) means that titles and/or caption are aligned to the plot panels. A value of "plot" means that titles and/or caption are aligned to the entire plot (minus any space for margins and plot tag).

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.