我使用webshot来保存wordcloud2创建的html小部件,但是每当我向figPath传递一个png文件时,我都会得到一个空白图像。如果我打开.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)发布于 2017-02-04 05:58:55
据我所知,FigPath是通向图像蒙版的路径。你应该试试这样的东西:
wordcloud2(freqdf, size=clsize, color =clcolor, backgroundColor =clbgcolor, figPath = "image.png")另外,包的创建者知道有一个已知的bug。要绕过此错误,您需要刷新查看器或在浏览器中打开它。有关包创建者的说明,请参阅此github issue。
希望这能有所帮助。
https://stackoverflow.com/questions/41085475
复制相似问题