Saving Word cloud to local disk


Can you please help to save word cloud in my local drive as an image?
I have used below code to create the word cloud-

wordcloud2(demoFreqC, figPath = figPath,color = "orangered",fontFamily = "Miso")

Perhaps I do not follow,

You can save the image manually with the RStudio IDE via the export button in the Viewer Pane;

Thanks for your reply.
I have tried the same, but i am looking for the code/command to get it done automatically through R programming.
also i have tried with "saveWidget", "plotly", "orca" but not get success.

One option is the webshot package. Here's "An Introduction to the webshot Package" by Winston Chang

The section "Save wordcloud2 as ...." in the R Graph Gallery lists the following code to save a wordcloud

#install webshot
# Make the graph
my_graph=wordcloud2(demoFreq, size=1.5)
# save it in html
saveWidget(my_graph,"tmp.html",selfcontained = F)
# and in png
webshot("tmp.html","fig_1.png", delay =5, vwidth = 480, vheight=480) # changed to png. 



I used it and command run successfully but I am not able to find my output file "fig_1.png" in my current working directory.

can you please help with this?

The line webshot("tmp.html","fig_1.png", delay =5, vwidth = 480, vheight=480) # changed to png. will save an imaged named fig_1.png to your working directory.

You can check where your working directory with;

#> [1] "/Users/notarobot/rstudio_git/community-sandbox"

Created on 2018-08-10 by the reprex package (v0.2.0.9000).

Here's a userful guide on working directories and workspaces with r and rstudio, Working Directories and Workspaces, by RStudio Support