I want to save the wordcloud2 view in Rstudio both as an html and a PNG file.
I am following the answers in this post, with wordcloud2, htmlwidgets and webshot libraries: How to Save the wordcloud in R
library(wordcloud2)
library(htmlwidgets)
library(webshot)
set.seed(1)
plot <- wordcloud2(word, freq, size = 1, minRotation = 0,
maxRotation = 0, shuffle = FALSE,
color = rainbow(nrow(word))
print(plot)
saveWidget(plot, "test.html", selfcontained = FALSE)
webshot("test.html", "test.png", delay=15)
The problem I am facing is that each of this visualizations are slightly different in terms of the position of the words. Is there a way to avoid this randomness across the saving steps?