Message Boards Message Boards

5
|
10964 Views
|
8 Replies
|
26 Total Likes
View groups...
Share
Share this post:

Can this neat chart be reproduced in Mathematica?

I thought it's a neat visualization. Is it possible to create this kind of a historical pie chart in Mathematica? The chart is interactive at the original site, but here is a screenshot of it.

POSTED BY: Shadi Ashnai
8 Replies
Posted 12 years ago
Here is our version. Browsers’ data are sorted alphabetically per month. I couldn't figure out how to include missing data so that the last segment wasn't filled.

 CreateRow[XMLElement["month", _, data_], browsers_] :=
 Module[{browserattrib, info, browsername, share, month, label, rules, output},
 browserattrib = Cases[data, XMLElement["browser", attrib_, _] :> attrib];
 share = "share" /. browserattrib;
 browsername = "name" /. browserattrib;
 month = "month" /. browserattrib;
 label = MapThread[StringJoin[#1, "\n", #2, ": ", ToString[100*ToExpression[#3]], "%"] &,
 {month, browsername, share}];
 rules = MapThread[(#3 -> Legended[Tooltip[ToExpression@#1, #2], #3] &), {share, label, browsername}];
output = (# -> If[(# /. rules) === #, Missing[], (# /. rules)]) & /@ browsers;
Last /@ output];


CreateArray[xml_] := Module[{browsers, months},
browsers = Union["name" /.Cases[xml, XMLElement["browser", attrib_, _] :> attrib, Infinity]];
months = Reverse@Cases[xml, XMLElement["month", _, _], Infinity];
CreateRow[#, browsers] & /@ months];


PieChart[CreateArray@Import["http://www.michaelvandaniker.com/labs/browserVisualization/\
srcview/source/data/browser_stats.xml.txt", "XML"],
SectorOrigin -> {{Pi/2, -1}, 10}, SectorSpacing -> None,
ImageSize -> 800, ChartStyle -> 54,
Epilog -> {Inset["January 2002", Center],
Inset["August 2009", Scaled[{.5, .92}]]}]

POSTED BY: Igor A
Min Peng:
Another version with PieChart:

data = Table[RandomInteger[{5, 100}, RandomInteger[{8, 12}, 1]], {10}];
PieChart[data, SectorOrigin -> {{Pi/2, -1}, 1}, SectorSpacing -> None]

It would be nice to have more meaningful data.

Right ... they also use style None for missing data which is why the last segment is not filled in. 

data = RandomReal[{0, 1}, {28, 10}];
PieChart[data, SectorOrigin -> {{Pi/2, -1}, 5}, SectorSpacing -> None, ImageSize -> 800, ChartStyle -> 46]
BarChart[data, ChartLayout -> "Percentile", ImageSize -> 800, ChartStyle -> 46]

Igor Antonio:
Here is our version. Browsers’ data are sorted alphabetically per month. I couldn't figure out how to include missing data so that the last segment wasn't filled.

I like this better as a bar chart. I wonder why they don't distinguish versions of Firefox?

POSTED BY: Brett Champion
This will get you close but not all the way there.  Maybe others can help.  Things I can't figure out how to do include:
(a) getting the sector rings to not show in the white zone
(b) getting a big hole in the middle of the donut with this many sectors
(c) making a nice balloon easily saying May 2004
 Module[{histories = 
 
    RandomFunction[WienerProcess[0, 0.3], {0, 1, 0.02}, 7]["Paths"], 
 
   annualFigures, withPseudoEntry},
 
  annualFigures = 
 
   Transpose[

   Map[With[{z = Last[#]}, Clip[z + 1, {0, 10}]] &, histories, {2}]];

 withPseudoEntry = Map[Append[#, Max[0, 8 - Total[#]]] &, annualFigures];

 Labeled[PieChart[withPseudoEntry, ImageSize -> 800, 

   SectorSpacing -> {None, None}, 

   ChartStyle -> {Red, Green, Blue, Yellow, Purple, Orange, Pink, 

     Append[Black, 0]}], "Proportions of Something Over Time", Top]

 

 ]
POSTED BY: Seth Chandler
We do have built in functions for this. For example SectorChart (or PieChart as Seth already demonstrated):

SectorChart[RandomReal[{0, 1}, {40, 10, 2}]]
POSTED BY: Arnoud Buzing
Another version with PieChart:

data = Table[RandomInteger[{5, 100}, RandomInteger[{8, 12}, 1]], {10}];
PieChart[data, SectorOrigin -> {{Pi/2, -1}, 1}, SectorSpacing -> None]

It would be nice to have more meaningful data.
POSTED BY: MinHsuan Peng
Igor Antonio:
Here is our version. Browsers’ data are sorted alphabetically per month. I couldn't figure out how to include missing data so that the last segment wasn't filled.

It's much more useful with our choice of colors. I found the color choices in the original confusing and hard to distinguish. With tooltips, even better! On the other hand, in a SectorChart[] like this, it reveals default click-pop-out behavior that's a little off with so many narrow slices of data.
POSTED BY: John Fultz
Brett Champion:

I like this better as a bar chart. I wonder why they don't distinguish versions of Firefox?

Is it possible to alter the colour scheme so that the bars on the right are easier to identify? I have trouble making a distinction between shades of orange, for example. (I assume it is, but I'm a novice Mathematica user.)

As for why there aren't distinct versions of Firefox represented, could it be that Firefox itself doesn't release that sort of information? I wonder if it's sort of like how in the USA, the government doesn't recognise dual-citizenship, although it does not force one to pick and choose. In the US government's eyes, you either are or are not a US citizen. Canada, on the other hand, would make the distinction between someone simultaneously possessing both Canadian and whatever other citizenships they might have. Could be like that, ay? Firefox is less interested in what version you have, it only cares that you are using its tools.
POSTED BY: Richard Clark
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