【问题标题】:How to make a wordcloud in R using a custom shape with wordcloud2?如何使用带有 wordcloud2 的自定义形状在 R 中制作 wordcloud?
【发布时间】:2020-10-30 16:27:53
【问题描述】:

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

虽然我遵循了多个教程,但我的代码总是会生成一张空白表。没有形状的标准可视化效果很好。

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

【问题讨论】:

    标签: r wordcloud2


    【解决方案1】:

    Heart image link i used。我在进行故障排除时从 github master repo 安装了worldcloud2,不确定是否有帮助。在我在 worldcloud2 函数中添加 size=1 之前,什么都没有为我呈现。我还将图片保存为 .jpg

    library(wordcloud2)
    library(RColorBrewer)
    #library(devtools)
    #install_github("lchiffon/wordcloud2")
    
    
    wordcloud2(demoFreq,size = 1,figPath = "heart.jpg") 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-01
      • 2022-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多