R plot: How to use mtext to get top-aligned vertical label with las=1

前端 未结 2 1787
渐次进展
渐次进展 2021-01-14 01:05

I\'m trying to get a label on my vertical axis using mtext that is read horizontally (las=1) and is at the top of the axis.

My attempt is t

2条回答
  •  攒了一身酷
    2021-01-14 01:40

    The trick is to access the height of the plot by calling par('usr')[4]:

    par(mar=c(2,3,2,1))
    plot(1, 1, ann=F)
    mtext(col="blue", "y", side=2, line=2, at=par('usr')[4], las=2)
    

提交回复
热议问题