Giving a title to each row of graphs created with grid.arrange() in R

Viewed 104

I've created 8 graphs using ggplot and would like to arrange them into 2 * 4 layout with grid.arrange(). Since the 8 graphs actually belong to 2 unique periods (4 graphs each), so it makes more sense to separate them into 2 rows and put a title with "year" label on each row. The output should look something like this:

grid.arrange(g1,g2,g3,g4,g5,g6,g7,g8, nrow = 2)

     year1
g1  g2  g3  g4
     year2
g5  g6  g7  g8

I've referenced this and this post which suggest that the arrangeGrob() function is the key, but when I found this function got my output clung together (it made 4 to cluster into one cell). Could anyone shed some lights on this?

0 Answers
Related