Rotating label using rot = on grid.arrange not working

Viewed 1030

I am trying to rotate one of the labels on my grid.arrange panel figure to look like the axis of all three plots, but this is not working using the methods I am finding online.

When I use a textGrob for control of the font size (which I need to be 24), using this code, I get this figure. I am inserting the rot= 90 argument but it isn't doing anything to the figure.

grid.arrange(d.a.plot1, d.b.plot1, d.c.plot1, ncol = 1, left = textGrob("Probability of remaining availabile", gp=gpar(fontsize=24, rot = 90)), bottom = textGrob("Depth(cm)", gp=gpar(fontsize = 24)))

enter image description here

When I use the standard grid.arrange code to add a rotated label using the code below, the position is fine, but then I can't adjust the font.

grid.arrange(d.a.plot1, d.b.plot1, d.c.plot1, ncol = 1, left = "Probability of remaining availabile", bottom = textGrob("Depth(cm)", gp=gpar(fontsize = 24)))

enter image description here

1 Answers

You just need to take rot = 90 out of gpar and pass it directly to textGrob:

# Simulate the plot grobs:
f <- function() cowplot::as_grob(~plot(rnorm(100), rnorm(100)))

grid.arrange(f(), f(), f(), ncol = 1,
            left = textGrob("Probability of remaining availabile", rot = 90, 
                            gp = gpar(fontsize=24)), 
            bottom = textGrob("Depth(cm)", gp=gpar(fontsize = 24)))

enter image description here

Related