Animated Bubble Chart
- To: mathgroup at smc.vnet.net
- Subject: [mg100018] Animated Bubble Chart
- From: Jon Rogers <jroge at mac.com>
- Date: Fri, 22 May 2009 01:42:13 -0400 (EDT)
I am looking to create an animated bubble chart similar to what Hans
Rosling did at TED a few years ago. It seems like Mathematica's
Manipulate function is a perfect tool for doing this. Can anyone
suggest some ideas on how to approach this? I am a newbie user and
have gotten stuck.
I am pulling in data using the CountryData function and one of the
examples from the built-in documentation. Here is the code from the
online documentation:
countries = CountryData["Europe"];
properties = {"PovertyFraction", "GDPPerCapita", "Population"};
data = {#1, Log@#2, #3} & @@@
Table[CountryData[c, p], {c, countries}, {p, properties}];
labeler[v_, {r_, c_}, ___] :=
Placed[Grid[{{Style[countries[[c]], Bold, 12], SpanFromLeft},
{"Poverty",
Row[{Round[100 v[[1]]], "%"}]}, {"GDP Per Capita",
Row[{"$", Round[Exp[v[[2]]]]}]}, {"Population",
Row[{NumberForm[v[[3]] 10^-6, {4, 2}], " million"}]}},
Alignment -> Left], Tooltip]
BubbleChart[data, ChartStyle -> 24, LabelingFunction -> labeler,
FrameLabel -> {"Poverty Fraction", "Log GDP Per Capita"}]
The chart is using poverty on the X-Axis, GDP Per Capita on the Y, and
Population for the bubble size. I would like to animate the bubbles
for a 10-year period, 1990-2000. Any pointers would be appreciated.
Thanks,
Jon
PS: Here is a link to Hans' TED presentation:
http://www.ted.com/index.php/talks/hans_rosling_shows_the_best_stats_you_ve_ever_seen.html