简体   繁体   English

更改图例文字大小

[英]Change legend text size

I have searched through stack overflow, I found the following link, but it does not help. 我搜索了堆栈溢出,我找到了以下链接,但它没有帮助。

r legend trouble , how to change the text size in legend r legend麻烦,如何更改图例中的文字大小

plot(c(1,1))
legend("topleft", "Legend", cex=1.3, pch=1, pt.cex = 1)

Setting pt.cex only changes the point size, but the text does not change at all. 设置pt.cex只会改变点大小,但文本根本不会改变。

Is there any way we can change the text size in the legend? 我们有什么办法可以改变图例中的文字大小吗?

You should be able to use the cex argument within legend() . 您应该能够在legend()使用cex参数。 To adjust the title as well, use both cex and cex.main . 要同时调整标题,请同时使用cexcex.main

Why are you trying to change the size of the text? 你为什么要改变文字的大小?

The most common reason that I have seen is that people are generating a plot at the default size, then saving that plot and shrinking it to fit into a report/article and then complain that the text is too small and so want to increase the size of the text so that it is a reasonable size after shrinking. 我看到的最常见的原因是人们正在生成默认大小的情节,然后保存该情节并将其缩小以适合报告/文章,然后抱怨文本太小,因此想要增加尺寸文本缩小后是合理的大小。

If this is the case, then the better approach is to generate the plot in the correct size to begin with so that you don't need to shrink the plot (and the text with it). 如果是这种情况,那么更好的方法是以正确的大小生成绘图,以便您不需要缩小绘图(以及带有它的文本)。 This prevents, rather than solves, the problem, and prevents other problems in the process. 这可以防止而不是解决问题,并防止该过程中的其他问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM