文本词云绘制错误

14
我有以下绘制词云的代码,但出现了下面的错误。
wordcloud(dm$word, dm$freq, scale=c(8,.2),min.freq=2,
+           max.words=Inf, random.order=FALSE, rot.per=.15, colors=rainbow

>Warning message:
In wordcloud(dm$word, dm$freq, scale = c(8, 0.2), min.freq = 2,:health insurance could not be fit on page. It will not be plotted. Unable to view plot.

我不明白为什么会发生这种情况。请帮忙。


10
尝试使用较小的比例,例如 scale = c(4,0.2) 或者更少的单词数量:例如 max.words = 30 - Victorp
也许在使用wordcloud之前,你可以使用gsub()函数将"health insurance"替换为"hlth ins.",这样它就能适应你想要的比例和单词数量了。 - lawyeR
非常感谢。较小规模的工作效果更好。 - Sridevi Vadapalli
3个回答

14

尝试使用较小的规模,例如:

wordcloud(Election2016Corpus, max.words =100,min.freq=3,scale=c(4,.5), 
           random.order = FALSE,rot.per=.5,vfont=c("sans serif","plain"),colors=palette())

6

你也可以尝试使用更大的设备来绘图,例如plotting

dev.new(width = 1000, height = 1000, unit = "px")
wordcloud(...)

请查看链接以了解其他绘制特定大小的方法。

1

wordcloud2(dm) 可能会起作用。你可以安装 wordcloud2 包,只需一个。


你好,欢迎来到Stack Overflow!请访问帮助中心,并阅读有关如何撰写良好答案的指南。您的帖子没有提供与问题相关的答案,更像是一条评论。 - Joey
1
警告,WordCloud2也存在同样的问题,但会静默丢弃不适合的单词。 - Allen Baron

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接