简体   繁体   English

r legend麻烦,如何更改图例中的文字大小

[英]r legend trouble , how to change the text size in legend

I think cex doesn't work. 我认为cex不起作用。 Cex will change the whole scale of the legend. Cex将改变传奇的整体规模。 But I just want to enlarge the text size. 但我只想扩大文字大小。 any command will help? 任何命令都会有帮助?

Yes!, set pt.cex = 1 and change cex as you want as in: 是的!,设置pt.cex = 1并根据需要更改cex ,如下所示:

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

You can set the cex for the points separately from the rest of the legend. 您可以将点的cex与图例的其余部分分开设置。 This would still make the box small, though. 不过,这仍然会使盒子变小。 A more specific example of what you're trying to do might help. 您尝试做的更具体的示例可能会有所帮助。 However, see if this solves your problem: 但是,看看这是否解决了您的问题:

plot(rnorm(10))
legend("top", legend="test", pch=21) #everything is normal sized (cex=1 default from par())
legend("topleft", legend="test", pch=21, cex=0.5) #everything is small
legend("topright", legend="test", pch=21, pt.cex=1, cex=0.5) #the point is normal, but the rest is small

Best of luck :) 祝你好运:)

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

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