正确的方法是添加一个外缘 with par(oma=...)
, 抑制注释ann=FALSE
,然后手动将它们添加到外边距中mtext(..., outer=TRUE)
etc.
layout(matrix(1:2,ncol=1),widths=1,heights=c(2,2),respect=FALSE)
par(mar = rep(0, 4), oma=c(4, 4, 4, 2), las=1)
plot(rnorm(100), type='l', ann=FALSE, xaxt='n')
plot(rnorm(100), type='l', ann=FALSE)
title("Hi", outer=TRUE)
mtext("x-axis", 1, 3, outer=TRUE)
mtext("y-axis", 2, 3, outer=TRUE, las=0)
这是一个参考:http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/ http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/
另请注意las
将所有标签变为水平的参数。它使阅读变得更容易,并向您的观众展示您知道您的情节:)