简体   繁体   English

如何在R中的grid_legend命令中更改图例文本的大小?

[英]How to change the size of the legend text in grid_legend command in R?

I am using the following command to draw legend on my plot. 我正在使用以下命令在图上绘制图例。 Since I have more than 30 labels, some of my labels are outside of my plot. 由于我有30多个标签,因此我的一些标签不在我的地块范围内。 I need to know how to decrease the size of my plot. 我需要知道如何减小图的大小。

grid_legend(0.9, 0.6, pch, col, labels, title="Bacterial Phyla")

I tried using cex=1 command and text.width=0.5 comment. 我尝试使用cex=1命令和text.width=0.5注释。 But it didn't work. 但这没有用。 I get an error stating: 我收到一条错误消息:

"Error in grid_legend(0.9, 0.5, pch, col, labels, text.width = 0.5, title = "Bacterial Class") : 
  unused argument (text.width = 0.5)"

Not the most reproducible example. 不是最可重复的例子。 But, try setting the cex and other parameters you want to change outside the legend function with par, for example par(cex=2) . 但是,请尝试使用par设置图例和要在图例函数之外更改的其他参数,例如par(cex=2)

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

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