In cowplot
/add_sub
, how do you align a multiple text label? Here is the code below. Thanks!
library(ggplot2)
library(cowplot)
p1 <- ggplot(mtcars,aes(mpg,disp))+
geom_line(colour="blue")+
theme_half_open()
p1_1 <- add_sub(p1,"this is an annotation.\n
Annotations can span multiple lines.",
color="red",size=14,
vpadding = grid::unit(0.5,"lines"),
lineheight = 0.5,
x=0.3,y=0.4)
ggdraw(p1_1)