我用 par(mfrow=c(2,2)) 绘制了 4 个图
。我想为上面 2 个图绘制一个通用标题,并为下面 2 个位于左右 2 个图之间的面板绘制一个通用标题。
这可能吗?
最佳答案
这个应该可以工作,但是您需要使用line
参数来使其正确:
par(mfrow = c(2, 2))
plot(iris$Petal.Length, iris$Petal.Width)
plot(iris$Sepal.Length, iris$Petal.Width)
plot(iris$Sepal.Width, iris$Petal.Width)
plot(iris$Sepal.Length, iris$Petal.Width)
mtext("My 'Title' in a strange place", side = 3, line = -21, outer = TRUE)
mtext
代表“边距文本”。 side = 3
表示将其放置在“顶部”边距中。 line = -21
表示将位置偏移 21 行。 outer = TRUE
表示可以使用外边距区域。
要在顶部添加另一个“标题”,您可以使用例如 mtext("My 'Title' in a odd place", side = 3, line = -2,outer = TRUE) 添加它
关于r - 使用 par(mfrow) 编译的图形面板的通用主标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14660372/