I am using webshot to save the html widget created by wordcloud2 but whenever i pass a png file to the figPath, i get a blank image. I can see the wordcloud if i open the .html file but the png created by webshot is blank. It works fine when figPath = NULL. I can't figure out why this is happening.
Here's my code :
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)
It's my understanding that FigPath is the path to your image mask. You should try something like this:
wordcloud2(freqdf, size=clsize, color =clcolor, backgroundColor =clbgcolor, figPath = "image.png")
Also, there's a known bug that the package creator is aware of. To get around the bug, you need to refresh the viewer or open it in the browser. See this github issue for the package creator's explanation.
Hopefully that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With