I would like to split the title into two parts that are left/right-aligned respectively. The following code creates two textgrobs and uses arrangeGrob() to arrange the plot. But it seems there is no options in arrangeGrob() to align grobs. How can I align grobs1 to the left of the plot and and grobs2 to the right of the plot? Thanks.
p <- ggplot() grobs1 <- grobTree( gp = gpar(fontsize = 14), textGrob(label = "Left", name = "title1", x = unit(2.5, "lines"), y = unit(0, "lines"), hjust = 0, vjust = 0), textGrob(label = " left", name = "title2", x = grobWidth("title1") + unit(2.5, "lines"), y = unit(0, "lines"), hjust = 0, vjust = 0, gp = gpar(col = "red", fontface = "bold")) ) grobs2 <- grobTree( gp = gpar(fontsize = 14), textGrob(label = "Right", name = "title1", x = unit(0, "lines"), y = unit(0, "lines"), hjust = 0, vjust = 0), textGrob(label = " right", name = "title2", x = grobWidth("title1") +unit(0, "lines"), y = unit(0, "lines"), hjust = 0, vjust = 0, gp = gpar(col = "red", fontface = "bold")) ) gg <- arrangeGrob(p, top = arrangeGrob(grobs1, grobs2, ncol = 2), padding = unit(1, "line")) grid.newpage() grid.draw(gg) 