控制轴刻度标签的字体大小

时间:2014-04-26 17:39:29

标签: r axis labels

可能是一个微不足道的问题,但我无法在网上找到一个直截了当的答案。

假设我绘制了这些数据:

plot(c(1:10),rnorm(10),xaxt="n",xlab="")

然后我想绘制我自己定义的x轴标签:

x.labs=c("a","b","c","d","e","f","g","h","i","j")
axis(1,at=c(1:10),labels=x.labs)

我的问题是如何调整标签的字体大小(使x.labs更大或更小)?

1 个答案:

答案 0 :(得分:4)

您可以使用cex.axis

plot(c(1:10), rnorm(10), xaxt = "n", xlab = "")    
x.labs = letters[1:10]
axis(1, at = c(1:10), labels = x.labs, cex.axis = 1.5)