我在子集A1中绘制了因子变量"answer"的图 . 我想减小两个轴上的文本大小,以便在x轴上适合两个极值 . 但是, when using cex.axis, only the font size on the y-label is affected ,不在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');
这是输出:
2 回答
当您在
factor
变量x
上使用plot
时,它默认调用barplot
(或更准确地说是barplot(table(x))
,即您可以查看?barplot
以获取提示 . 在这种情况下,正如我在评论中提到的那样,x-axis
被视为标签,而不是一个数字轴,因此您需要像这样使用cex.names
:另外,如上所述,如果要直接使用
barplot
,则需要先创建一个表我只是偶然发现了格子中的条形图功能,这有一个更好的输出: