ggpubr
ggpubr copied to clipboard
Cannot add subtitle
I am trying to use a common title and subtitle for my plots. How can I add a line below the title, that is also in a different font?
Here is a MWE of what I'm doing:
library(tidyverse)
library(ggpubr)
df <- data.frame()
plot1 <- ggplot(df) + geom_point() + xlim(0, 10) + ylim(0, 100)
plot2 <- ggplot(df) + geom_point() + xlim(0, 10) + ylim(0, 100)
all.plots <- ggarrange(plot1, plot2)
annotate_figure(all.plots,
top=text_grob("Antibiotic Effectiveness"))
I would also like to be able to add a subtitle for the plots. I think this is a good idea that should be implemented.
@angoodkind, I know this is years after you needed it, but as a temporary fix, you can use annotate_figure
twice to obtain the desired effect. Using the example above
annotate_figure(
annotate_figure(all.plots,
top=text_grob("Subtitle"),
),
top=text_grob("Antibiotic Effectiveness (Main title)")
)