R中的多面板标题 [英] Multi-panel titles in R

查看:75
本文介绍了R中的多面板标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于R我有一个简短的问题

I have an ultra short question about R

我的目的是为使用par生成的多面板图分配一个通用标题,例如

My aim is to assign a common title to a multi-panel plot generated using par, e.g.

par(mfrow=c(1,2))
plot(rnorm(1000))
plot(rnorm(1000))

因此,绘图功能类似"main",但扩展到两个绘图.有规范的方法可以做到这一点吗?

So, something like "main" for the plot function, but extended to both plots. Is there a canonical way to do this?

谢谢您的回答:-)

推荐答案

在选项outer中使用mtext:

set.seed(42)
oldpar <- par(mfrow=c(1,2), mar=c(3,3,1,1), oma=c(0,0,3,1))  ## oma creates space 
plot(cumsum(rnorm(100)), type='l', main="Plot A")
plot(cumsum(rnorm(100)), type='l', main="Plot B")
mtext("Now isn't this random", side=3, line=1, outer=TRUE, cex=2, font=2)
par(oldpar)

这篇关于R中的多面板标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆