简体   繁体   中英

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

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.

Is there any way we can change the text size in the legend?

You should be able to use the cex argument within legend() . To adjust the title as well, use both cex and cex.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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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