I want to align a tableGrob chart to the top of a pdf. The default setting is the middle. My issue is when I have charts with different row numbers.
library(ggplot2)
g <- gridExtra::tableGrob(head(iris))
g2 <- gridExtra::tableGrob(iris[1:3,])
pdf("test.pdf")
gridExtra::grid.arrange(g, heights = c(1,3), padding = unit(1,"in"), top =
"Title")
gridExtra::grid.arrange(g2, heights = c(1,3), padding = unit(1,"in"), top =
"Title2")
dev.off()
The spacing between the titles and charts is not consistent. The space between "Title2" and g2 is much greater than "Title" and g. How can I "lock" both charts to, say, 1.5 in. from the top of the page? Ultimately, I will have lots of charts with varying row numbers and do not want to change the "heights" argument manually each time.