Basilique
Basilique

Reputation: 180

Align marrangGrob title to the left limit of the plot

My question addresses the second solution given to this question : locate title in top left of grid.arrange.

I would like to put the title on the top left corner of an marrangeGrob, but also align it vertically with the left limit of the plot.

Is there a way to do this automatically: without finding by try and error the proper value for the x argument of the textGrob ?

Upvotes: 1

Views: 148

Answers (1)

zx8754
zx8754

Reputation: 56219

Maybe add the title for left plot only:

library(ggplot2)
library(gridExtra)

p1 <- qplot(1:20) + ggtitle("Title")
p2 <- qplot(30, 35) + ggtitle("")

grid.arrange(p1, p2, nrow = 1)

enter image description here

Upvotes: 2

Related Questions