简体   繁体   中英

Is it possible to change the legend size in base R (no ggplot2)

Good morning, I was wandering if there was an option (or a function whatsoever) that allows to modify the size of the "legend" square in a plot made with R base. I've looked up the web, but it seems that I can do everything with my legend but change its size. Does somebody know if it is possible? If yes, how?

Thank you all in advance, Peppe

Assuming a legend of this type

legend("topright",
       legend = c("Var 1", "Var 2"),
       col = 1:2,
       pch = 16,
       cex = 2.5)

cex manages the size of the legend

Like this? Graphics parameter cex stands for c haracter ex pansion.

plot(1)
legend("top", legend = "legend size test")
legend("bottom", legend = "legend size test", cex = 1.5)

在此处输入图像描述

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