R删除Wordcloud中单词之间的距离

时间:2018-09-05 10:53:14

标签: r word-cloud

我有以下数据框:

df <- data.frame(word = c("text1","text2","text3","text3","text3","text3","text3","text3","text3","text3","text3","text3","text3","text3",
                          "text3","text3","text3","text3","text3","text3"), 
                 freq = c(6500,6400,4500,4400,4000,3800,3300,2900,2300,1200,900,2496,5203,3507,724,1047,725,5739,3927,4085),
                 stringsAsFactors = FALSE)

并创建以下wordcloud:

cloud2 <- wordcloud(words = df$word, min.freq = 1500,freq = df$freq,random.order=FALSE, 
                    random.color = FALSE, rot.per=0.35, colors= brewer.pal(8,"Dark2"), scale = c(3,0),
                    vfont=c("sans serif","plain"))

以某种方式,不同的词之间有很大的间隔。因此,一两个词通常不完全可见。 enter image description here 有可能消除较大距离吗? 在类似this link的其他词云中,两个词彼此非常接近。

使用过的软件包:

library(tm)
library(RColorBrewer)
library(wordcloud)

1 个答案:

答案 0 :(得分:0)

这里没有问题。

R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 Service Pack 1


other attached packages:
wordcloud_2.5 

enter image description here