R {wordcloud} package, what do the values in scale represent?

我只是一个虾纸丫 提交于 2019-12-10 15:48:17

问题


This seems like a simple question, but I can't seem to find an answer anywhere. In the R {wordcloud} package, the wordcloud function, there is a scale value that you can enter. The full documentation (here: https://cran.r-project.org/web/packages/wordcloud/wordcloud.pdf) says: "A vector of length 2 indicating the range of the size of the words."

I can't seem to make any sense of the values though, and I can't find any other documentation. For instance, examples have scale=c(4,.5) or scale=c(8,.3). What do these numbers mean?

I've messed around with different values a bit, but I can't seem to figure out the pattern. Thanks in advance for any help, Seth


回答1:


wordcloud internally calculates

size <- (scale[1] - scale[2]) * normedFreq + scale[2]

where the 2 elements of size are used to set strheight and strwidth. These are graphics values described as follows:

These functions compute the width or height, respectively, of the given strings or mathematical expressions s[i] on the current plotting device in user coordinates, inches or as fraction of the figure width par("fin").

So, long story short, it's height and width.



来源:https://stackoverflow.com/questions/38335444/r-wordcloud-package-what-do-the-values-in-scale-represent

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