问题
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