Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to build a Tag Cloud Graph?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98651] Re: How to build a Tag Cloud Graph?
  • From: m.r at inbox.ru
  • Date: Wed, 15 Apr 2009 05:00:39 -0400 (EDT)
  • References: <gruq3m$12t$1@smc.vnet.net>

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

Here's a toy example:

len = Length@ CountryData[];
str = CountryData[#, "Name"]& /@ CountryData[];
sz = Rescale[Rescale[
    CountryData[#, "Population"]& /@ CountryData[] // #^(1/3)&],
   {0, 1}, {4, 48}];
col = RandomChoice[{Magenta, Darker@ Cyan}, len];
cloud = MapThread[Style[##, Bold]&, {str, sz, col}];

StringJoin@ Riffle[ToString[#, StandardForm]& /@ cloud, " "]

Maxim Rytin
m.r at inbox.ru


  • Prev by Date: Re: How to build a Tag Cloud Graph?
  • Next by Date: axis label position
  • Previous by thread: Re: How to build a Tag Cloud Graph?
  • Next by thread: Re: How to build a Tag Cloud Graph?