Message Boards Message Boards

WordCloud function with duplicates only but different weights

Posted 1 year ago

Hello

Let's take an example:

list = Table[{"anything", RandomInteger[{1, 100}]}, 5];

With the WordCloud function applied to this Table I will get a single instance of the string and not five of them scaled accordling to their weight., which is what I'm trying to achieve..

With the help of MapIndexed as below:

 WordCloud@
  MapIndexed[
    StringJoin[#[[1]], 
      ConstantArray["\[InvisibleSpace]", First@#2]] &]@list

I get all the 5 instances of the string but the weight is here is not taken into account and I haven't been able to find a solution.

Thanks

POSTED BY: Jan Potocki
2 Replies
Posted 1 year ago

Yes indeed Thanks a lot

POSTED BY: Jan Potocki

Hi Jan,

The weights are missing from the last example. Add them

WordCloud@
 MapIndexed[{StringJoin[#[[1]], 
      ConstantArray["\[InvisibleSpace]", First@#2]], #[[2]]} &]@list
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

Group Abstract Group Abstract