Why doesn't R add the title at the top of the page?

青春壹個敷衍的年華 提交于 2020-01-05 07:00:38

问题


I'm trying to add a title at the top of the page scatterplots, however whenever I use the command title it doesn't add the title at the top of page and overwrites my plots. Is there a way to fix this ?

plot(median, pch = ".")
title(main = "Scatterplot of the median vectors ",line = 0,font=2)

回答1:


Did you look at the mtext() command? Did you look at the par(oma=c(...)) option? Try something like

oldpar <- par(oma=c(0,0,2,0), mar=c(3,3,3,1), mfrow=c(1,2))
plot(cumsum(rnorm(1:100)), main="First plot", type='l')
plot(cumsum(rnorm(1:100)), main="Second plot", type='l')
mtext("Overall title", outer=TRUE, cex=1.5)
par(oldpar)



回答2:


There is no reason your code should not work as is. It works for me just fine. Are you attempting to do something more than the example code you gave?

Is there a reason not to just use plot(median, pch = ".", main = "Foo")?



来源:https://stackoverflow.com/questions/1656026/why-doesnt-r-add-the-title-at-the-top-of-the-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!