我正在尝试旋转grid.arrange面板图上的标签之一,使其看起来像所有三个图的轴,但是使用我在网上找到的方法,这不起作用。
当我使用textGrob来控制字体大小(我需要为24)时,使用此代码,我得到了这个数字。我正在插入rot = 90参数,但它对图形没有任何作用。
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)))
当我使用下面的代码使用标准grid.arrange代码添加旋转标签时,位置很好,但随后我无法调整字体。
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)))
您只需要从rot = 90
中取出gpar
并将其直接传递给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)))