ang*_*ath 5 r text-mining word-cloud
我正在使用 webshot 来保存 wordcloud2 创建的 html 小部件,但是每当我将 png 文件传递给 figPath 时,我都会得到一个空白图像。如果我打开 .html 文件,我可以看到 wordcloud,但是 webshot 创建的 png 是空白的。当 figPath = NULL 时它工作正常。我不明白为什么会这样。
这是我的代码:
library(wordcloud2)
library(RColorBrewer)
File <- "image.png"
library(webshot)
library(htmlwidgets)
graph <- wordcloud2(freqdf, size=clsize, color =clcolor, backgroundColor =clbgcolor,
figPath = clfigpath)
saveWidget(graph,"tmp.html",selfcontained = FALSE)
webshot("tmp.html",File, delay = 20)
Run Code Online (Sandbox Code Playgroud)
据我了解, FigPath 是图像蒙版的路径。你应该尝试这样的事情:
wordcloud2(freqdf, size=clsize, color =clcolor, backgroundColor =clbgcolor, figPath = "image.png")
Run Code Online (Sandbox Code Playgroud)
此外,包创建者也意识到了一个已知错误。要解决该错误,您需要刷新查看器或在浏览器中打开它。请参阅此github 问题以获取包创建者的解释。
希望这有帮助。