我有以下数据帧:
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"))
不知何故,不同的词之间有很大的空间。因此,一两个词通常不完全可见。 有可能移除很远的距离吗?在像this link这样的其他wordcloud中,单词彼此非常接近。
二手包装:
library(tm)
library(RColorBrewer)
library(wordcloud)