title: How to put a wordcloud in a pdf with a good quality
body: <p>I am using the R package <code>wordcloud2</code>. It works fine, but I need to produce a pdf with the result and the only way I have found is the following.
  I have already obtained a dataframe with words and corresponding frequencies:</p>
  
  <pre><code>&gt; ds
            word freq
  1         data   33
  2        cloud   32
  3  complessità   29
  4       system   29
  5      cliente   24
  6       soglia   24
  7      servizi   19
  8      network   18
  9     digitale   17
  10       radio   17
  11    progetto   15
  12       scada   15
  13   ticketing   15
  14   telephone   14
  15         web   14
  16         app   13
  17    business   13
  18 engineering   13
  19   requisiti   13
  20     sistema   13
  </code></pre>
  
  <p>Now</p>
  
  <pre><code>library(wordcloud2)
  library(webshot)
  library("htmlwidgets")
  webshot::install_phantomjs()
  set.seed(142)
  my_graph  = wordcloud2(ds, size = 1.5, #widgetsize = 10,
                         minRotation = -pi/4, maxRotation = -pi/4)
  </code></pre>
  
  <p>Once I have created the wordcloud2 object (note: I cannot find good values for <code>widgetsize</code>. Every time I use it, I obtain an empty image. Maybe I could use it to create an higher defined object), I put it in an html, and then i convert the html in a pdf:</p>
  
  <pre><code># sizingPolicy(defaultWidth = 100, ....) &lt;- possible solution?
  saveWidget(my_graph, "myDocument.html"  , selfcontained = F)
  webshot("myDocument.html","myFigure.pdf", delay =6, vwidth = 1500, vheight=1500)
  </code></pre>
  
  <p>I obtain a picture with a low definition:</p>
  
  <p><a href="https://i.stack.imgur.com/rwIZB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rwIZB.png" alt="enter image description here"></a></p>
  
  <p>In which part of the procedure can I set an higher dimension for my final image? I would like to take my <code>wordcloud2</code> graph (<code>my_graph</code>) and directly create a pdf (or png, etc.) with the dimensions I need. Is there a way?</p>