开发者

Axis label placement

I've got a probably fairly simple question. I want to put my y-axis label horizontally above the y-axis, in stead of the default (vertically alo开发者_Python百科ngside the y-axis). This probably requires a par() command, but which one?

thanks in advance!


I don't think par is what you want. You could just adjust the default, exclude the label of the y-axis with ylab = "" and manually add your text with marginal text input (mtext). Example:

xx <- 1:20
yy <- 55 + 50 * xx - 3 * xx ^ 2

plot(x = xx, y = yy, type = "l", ylab="")
mtext("yy", side = 3, at = -1)

Or as a function:

newplot <- function(xx, yy) {
  plot(x = xx, y = yy, type = "l", ylab="")
  mtext(deparse(substitute(yy)), side = 3,
    at = - sum(range(xx)) / range(xx)[2])
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜