Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.7K Views
|
4 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Modifying a simple wordcloud graphic example from the Wolfram wiki

Posted 5 years ago

I am trying to nearly copy an example i see from the URL below:

https://www.wolfram.com/language/11/new-visualization-domains/fit-a-word-cloud-into-a-shape.html?product=mathematica

With the small difference of, instead of using a crow, using the output of this graphic as the figure: Graphics[{Black, CountryData["Australia", "SchematicPolygon"]}]

However, things seem to be out of scale, and I cannot ever get the text to form in the shape of the Australia graphic.

It's never clear to me how one object relates to another in terms of the classic programming OO inheritance tree, etc, so I never know how (or whether) I can use this object as a similar graphic as the crow. Can someone shed some light on what's going wrong here?

Here's the code fragment:

POSTED BY: Cere Davis
4 Replies
Posted 5 years ago

Perhaps due to this unfortunate backwards incompatible change in 12.1. Try setting $ImageResolution = 72.

POSTED BY: Rohit Namjoshi
Posted 5 years ago

I'm running 12.1 .0 Wolfram Desktop on a Mac OSX 10.14 btw.

POSTED BY: Cere Davis
Posted 5 years ago

Hi,

Thanks. That almost worked, almost. Still the scale when I run this exact same code seems off compared to what you're run produced. Can you think of a reason why this would happen? See attached image.

Attachment

Attachments:
POSTED BY: Cere Davis
Posted 5 years ago

Hi Cere,

Try this

polygon = Graphics[{Black, CountryData["Australia", "Polygon"]}];
maskData = ColorNegate[polygon];

backdrop = Image[Graphics[{Black, Rectangle[{0, 0}, {2, 2}]}, 
                   Background -> Black], ImageSize -> {700, 700}];

mask = Image[ImageCompose[backdrop, maskData], ImageSize -> {300, 300}];

text = WikipediaData["frog"];

WordCloud[ToLowerCase@DeleteStopwords@StringTake[text, 1000], mask,
 Background -> Black,
 ImageSize -> 400,
 ColorFunction -> ColorData["SiennaTones"]]

enter image description here

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard