wordcloud(wordcloud)
wordcloud()所属R语言包:wordcloud
Plot a word cloud
绘制一个字云
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Plot a word cloud
绘制一个字云
用法----------Usage----------
wordcloud(words,freq,scale=c(4,.5),min.freq=3,max.words=Inf,random.order=TRUE, random.color=FALSE,
rot.per=.1,colors="black",ordered.colors=FALSE,use.r.layout=FALSE,...)
参数----------Arguments----------
参数:words
the words
的话
参数:freq
their frequencies
它们的频率
参数:scale
A vector of length 2 indicating the range of the size of the words.
甲向量,长度为2表示的范围内的大小的字词。
参数:min.freq
words with frequency below min.freq will not be plotted
词语的与频率低于min.freq将不被绘制
参数:max.words
Maximum number of words to be plotted. least frequent terms dropped
的最大数目的词语被绘制。最不常用术语下降
参数:random.order
plot words in random order. If false, they will be plotted in decreasing frequency
图以随机顺序的话。如果为false,他们将被绘制在降低频率
参数:random.color
choose colors randomly from the colors. If false, the color is chosen based on the frequency
随机选择的颜色,从颜色上看。如果为false,颜色选择的基础上的频率
参数:rot.per
proportion words with 90 degree rotation
90度旋转的比例的话,
参数:colors
color words from least to most frequent
颜色的话,最常见的
参数:ordered.colors
if true, then colors are assigned to words in order
如果消息属实,那么颜色分配的话,
参数:use.r.layout
if false, then c++ code is used for collision detection, otherwise R is used
如果为false,则c + +代码用于碰撞检测,或者R使用
参数:...
Additional parameters to be passed to text (and strheight,strwidth).
额外的参数传递的文本(strheight,strwidth)。
值----------Value----------
nothing
无
参见----------See Also----------
text
text
实例----------Examples----------
if(require(tm)){
data(crude)
crude <- tm_map(crude, removePunctuation)
crude <- tm_map(crude, function(x)removeWords(x,stopwords()))
tdm <- TermDocumentMatrix(crude)
m <- as.matrix(tdm)
v <- sort(rowSums(m),decreasing=TRUE)
d <- data.frame(word = names(v),freq=v)
wordcloud(d$word,d$freq)
#A bigger cloud with a minimum frequency of 2[一个更大的云最小频率为2]
wordcloud(d$word,d$freq,c(8,.3),2)
#Now lets try it with frequent words plotted first[现在,让我们尝试用频繁的话绘制第一]
wordcloud(d$word,d$freq,c(8,.5),2,,FALSE,.1)
##### with colors #####[#########用颜色]
if(require(RColorBrewer)){
pal <- brewer.pal(9,"BuGn")
pal <- pal[-(1:4)]
wordcloud(d$word,d$freq,c(8,.3),2,,FALSE,,.15,pal)
pal <- brewer.pal(6,"Dark2")
pal <- pal[-(1)]
wordcloud(d$word,d$freq,c(8,.3),2,,TRUE,,.15,pal)
#random colors[随机颜色]
wordcloud(d$word,d$freq,c(8,.3),2,,TRUE,TRUE,.15,pal)
}
##### with font #####[####字体#####]
wordcloud(d$word,d$freq,c(8,.3),2,,TRUE,,.15,pal,
vfont=c("gothic english","plain"))
wordcloud(d$word,d$freq,c(8,.3),2,100,TRUE,,.15,pal,vfont=c("script","plain"))
wordcloud(d$word,d$freq,c(8,.3),2,100,TRUE,,.15,pal,vfont=c("serif","plain"))
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|