r - 使用 par(mfrow) 编译的图形面板的通用主标题

标签 r graph plot title par

我用 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)

enter image description here

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/

相关文章:

r - sparse.model.matrix 在 R 中丢失行

javascript - 如何使用 Javascript 显示图表

javascript - 使用d3绘制散点图

r - 将代码传递给 Rmarkdown 渲染函数的输入而不是文件

python - 高效更新多个 pyplots

r - Dplyr 计数/多个过滤器计数

r - 新安装 doMPI 抛出 MPI_ERR_SPAWN 错误

algorithm - 流程图的可证明平面性

python - 使用数据帧的行绘制线图,并在 python pandas 中按位置/数字包含特定列

在 groupby r 之后删除所有 NA 值的行