I am trying to vectorize the title and subtitle of a figure within the R expression using atop() function as in the example below with no success. Could anyone help me with this?
title = "Text line 1"
subtitle = "Text line 2"
fig1 = ggplot(mtcars, aes(x = cyl, y = mpg))+geom_boxplot(stat = "boxplot")
fig2 = ggplot(mtcars, aes(x = cyl, y = mpg))+geom_point()
fg = ggarrange(fig1, fig2, ncol = 2, nrow = 1)
title <- expression(atop(title, scriptstyle(subtitle)))
annotate_figure(fg, top = text_grob(title, face = "bold", size = 14))

