r legend trouble , how to change the text size in legend

ε祈祈猫儿з 提交于 2019-12-03 06:42:00

问题


I think cex doesn't work. Cex will change the whole scale of the legend. But I just want to enlarge the text size. any command will help?


回答1:


Yes!, set pt.cex = 1 and change cex as you want as in:

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



回答2:


You can set the cex for the points separately from the rest of the legend. 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 :)



来源:https://stackoverflow.com/questions/16905535/r-legend-trouble-how-to-change-the-text-size-in-legend

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!