In ggplot I have two figures made by facet_wrap and I would like to have two subtitles Versicolor and Virginica left aligned to each figures. How is it possible? I tried James Allison’s How to add multiple captions in ggplot2 outside of the main graph area solution but it was a single figure. Here is what I tried, but I did not get what I want.
iris %>% filter(Species != 'setosa') %>%
ggplot(aes(x= Petal.Length, y= Petal.Width))+
geom_point()+
facet_wrap(~ Species)+
theme(strip.text.x = element_blank())+ # to get rid of grey box with species names
labs(subtitle = 'Versicolor') # adding virginica
>Solution :
One option would be to fake your subtitles using the strip text:
library(ggplot2)
library(dplyr, warn = FALSE)
iris %>%
filter(Species != "setosa") %>%
ggplot(aes(x = Petal.Length, y = Petal.Width)) +
geom_point() +
facet_wrap(~Species) +
theme(
strip.background.x = element_blank(),
strip.text.x = element_text(hjust = 0, size = 11)
)

