问题
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