Multi-panel titles in R

后端 未结 1 1227
情话喂你
情话喂你 2021-01-05 12:38

I have an ultra short question about R

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

par(mfrow=c(1,2))
plot(rnor         


        
1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-05 13:02

    Use mtext with option outer:

    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)
    

    0 讨论(0)
提交回复
热议问题