0

我想在 R 中创建一个单词云,其中的单词在图片的形状内。一个常见的例子是使用 Twitter 鸟形状,如Wordcloud 中所示的特定形状

尽管我遵循了多个教程,但我的代码总是导致空白表。没有形状的标准可视化效果很好。

library(wordcloud2)
library(RColorBrewer)

wordcloud2(demoFreq, size = 0.7, shape = 'star') # -> this works fine

#put picture in current working directory
getwd() #get current working directory
wordcloud2(demoFreq, figPath="heart.png", size = 1.5, color = "skyblue", backgroundColor="black") # -> this does not show anything
4

1 回答 1

0

我使用的心脏图像链接。我在进行故障排除时安装了worldcloud2from github master repo,不确定是否有帮助。在我添加size=1worldcloud2 函数之前,没有为我呈现任何内容。我还将图片另存为.jpg

library(wordcloud2)
library(RColorBrewer)
#library(devtools)
#install_github("lchiffon/wordcloud2")


wordcloud2(demoFreq,size = 1,figPath = "heart.jpg") 

在此处输入图像描述

于 2020-10-30T16:54:28.217 回答