I noticed that if my labels are of varying length, the position of the text will translate to the right. This makes the alignment of my figure captions differ between my images. I initially found this issue while using ggpubr but it appears that the function annotate_figure calls the draw_figure_label from cowplot, and is likely the source of what I am experiencing.
For example, adjusting some code from the documentation:
library(cowplot)
p1 <- qplot(1:10, 1:10)
p2 <- qplot(1:10, (1:10)^2)
p3 <- qplot(1:10, (1:10)^3)
p4 <- qplot(1:10, (1:10)^4)
# Create a simple grid
p <- plot_grid(p1, p2, p3, p4, align = 'hv')
p + draw_figure_label(label = "Short Label")
p + draw_figure_label(label = "THIS IS A SUPER SUPER DUPER LONG LABEL LOOK AT ME ……")
I noticed that if my labels are of varying length, the position of the text will translate to the right. This makes the alignment of my figure captions differ between my images. I initially found this issue while using
ggpubr
but it appears that the functionannotate_figure
calls thedraw_figure_label
fromcowplot
, and is likely the source of what I am experiencing.For example, adjusting some code from the documentation: