cex.axis 只影响 y 轴,不影响 x 轴

Thi*_*nis 1 plot r

我在子集 A1 中绘制了因子变量“answer”的图。我想减小两个轴上的文本大小,以适应 x 轴上的两个极值。但是,使用 cex.axis 时,仅影响 y 标签上的字体大小,而不影响x 轴上的字体大小。为什么会这样,我该如何改变?

我使用的功能是:

plot(A1$answer, main = "Would you recommend edX to a friend of you?", xlab = "Answer", ylab = "#students", col='lightblue', cex.axis=0.75, font=3, family='mono'); box(col='lightblue');
Run Code Online (Sandbox Code Playgroud)

这是输出:

edX推荐

adi*_*der 5

当您使用它默认调用plotfactor变量xbarplot(或者更准确地说barplot(table(x)),您可以查看?barplot提示。在这种情况下,正如我在评论中提到的,x-axis被视为标签,而不是数字轴,因此您需要cex.names像这样使用:

tab <- as.ordered(sample(1:10, 100, replace = TRUE))
plot(tab, cex.axis = 0.75, cex.names = 0.75)
Run Code Online (Sandbox Code Playgroud)

还有上面提示的,如果想barplot直接使用,需要先做一个表

barplot(table(tab), cex.axis = 0.75, cex.names = 0.2)
Run Code Online (Sandbox Code Playgroud)