0
$\begingroup$

I am running:

WordCloud[{{"aw", 5}, {"bw", 1}}]

and I am getting correct plot in notebook, which looks like: enter image description here

Now if I am trying to increase resolution with width 1200 pixels while maintaining original aspect ratio and for it modified code to:

WordCloud[{{"aw", 5}, {"bw", 1}}, ImageSize -> 1200, 
 AspectRatio -> Automatic]

it produces incorrect image which looks like:

enter image description here

Same incorrect result if I try to save plot as png file with width 1200 pixels and maintain original aspect ratio. Code:

SetDirectory[NotebookDirectory[]]
Export["sample.png",WordCloud[{{"aw",5}, {"bw", 1}}], ImageSize->1200, AspectRatio->Automatic]



Question: How to correct my code above to get plot with specifed width in pixels and maintain original aspect ratio? I do not only need only to get 1200 pixel width plot but to be able to change width value to different value and get correct image.

$\endgroup$
8
  • 1
    $\begingroup$ On my system (MM 12.3.1, Mac OS) your code produces a PNG that shows both words, regardless of size. What version of Mathematica and OS are you using? $\endgroup$ Jun 1, 2023 at 20:34
  • $\begingroup$ @MichaelSeifert Strange. I use Mathematica 13.2.1.0. on Windows 10. $\endgroup$
    – vasili111
    Jun 1, 2023 at 20:39
  • $\begingroup$ may be try: Export["sample.png",WordCloud[{{"aw",5}, {"bw", 1}}]//Evaluate, ImageSize->1200, AspectRatio->Automatic]? $\endgroup$
    – chris
    Jun 1, 2023 at 20:40
  • $\begingroup$ @chris Result is the same, incorrect image. Does the code on your system produces correct image file? If yes, which is your OS and Mathematica system? $\endgroup$
    – vasili111
    Jun 1, 2023 at 20:43
  • $\begingroup$ @MichaelSeifert Updated question. It seems the problem is in notebook too when increasing width. $\endgroup$
    – vasili111
    Jun 1, 2023 at 21:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.