Re: How to build a Tag Cloud Graph?

• To: mathgroup at smc.vnet.net
• Subject: [mg98698] Re: How to build a Tag Cloud Graph?
• From: LectorZ <zanzibarlector at googlemail.com>
• Date: Thu, 16 Apr 2009 04:17:13 -0400 (EDT)
• References: <gruq3m\$12t\$1@smc.vnet.net> <gs47gn\$7ju\$1@smc.vnet.net>

```On 15 Apr., 10:56, Albert Retey <a... at gmx-topmail.de> wrote:
> LectorZ wrote:
> > Dear experts,
>
> > Let say, I have a simple list of sales numbers in different products.
> > The first element of the sublist is a product, the second is a product
> > group and the 3rd is the turnover. Like this one:
>
> > sales={{Beef,Meat, 2343},{Milk,Drink, 234}, {Water,Drink, 234}, {Beer=
,
> > Drink, 1546}, {Coke, Drink, 1223}, {Pork, Meat, 1223}}
>
> > QUESTION:
> > How to construct a Tag Cloud Plot in the way as it defined in
> > wikipedia:
>
> > "...Tags are usually single words and are typically listed
> > alphabetically, and the importance of a tag is shown with font size or
> > color..."
>
> > For full details see:
> >http://en.wikipedia.org/wiki/Tag_cloud
>
> > It should be a frame with words in alphabetical order with different
> > font color for different product group.
>
> > Condition:
> > For displaying products with huge and very small numbers a maximum and
> > minimum font size should apply.
>
> > Many thanks!
>
> > Plotty
>
> Something like this?
>
> color[___] = Black;
> color[Drink] = Blue;
> color[Meat] = Pink;
> maxfont = 100;
> minfont = 10;
> Panel[Row[Apply[
>    Tooltip[
>      Style[#1, "FontFamily" -> "Helvetica",
>       "FontSize" -> Max[maxfont*#3/Max[sales[[All, 3]]], minfont],
>       "FontColor" -> color[#2]
>       ],
>      #3
>      ] &,
>    SortBy[sales, First],
>    {1}
>    ],
>   Spacer[5]
>   ]
>  ]
>
> of course you might want to use something smarter for the font sizes,
> that tag cloud...
>
> albert

Hi Albert,

Thanks a lot! That is exactly what I want!!!
One more thing: Is it possible to change the background color of a
Panel from gray to white?

Plotty

```

• Prev by Date: Re: Image Analysis: identifying objects with Mathematica 7.0
• Next by Date: Re: Brace, bracket pretty format needed
• Previous by thread: Re: How to build a Tag Cloud Graph?