Wordcloud2 包不适用于 figpath

Wordcloud2 package not working for figpath

我看到了类似的 post 但解决方案没有帮助。

尝试将得克萨斯州的 photo 与词云一起使用。但是它不起作用....

word_cloud <- structure(list(word = c("climate", "change", "global", "warming", 
"energy", "carbon", "u.s", "president", "emissions", "people", 
"obama", "gas", "world", "report", "power", "water", "time", 
"scientists", "study", "national"), count = c(2474L, 1655L, 944L, 
815L, 755L, 635L, 585L, 570L, 564L, 556L, 522L, 484L, 475L, 462L, 
435L, 398L, 375L, 354L, 352L, 341L)), row.names = c(NA, -20L), class = c("tbl_df", 
"tbl", "data.frame"))

figPath <- "tex4.png" #TODO
wordcloud2(word_cloud, figPath = figPath, size = 1.5,color='skyblue')

给你,你的得克萨斯州的照片。(呸...真的花了很多时间来识别它。)

备注

您的代码是正确的,它也能正常工作。 来自 wordcloud2subtle 免责声明,您错过的是...

wordcloud with fig and letterCloud may disappeared in Rstudio Viewer, open into brower when you meet this bug

所以,你需要做的是:

  1. 运行 你的代码。
  2. 点击下图圈出的图标: