Reusable Charts : Part 5 : Needs More Pie Chart!

Before going further into the main topic of this post, first let me give a shout out to klr or @timelyportfolio.  KLR’s blog is over here.  KLR was able to combine NVD3 and the very rough DexCharts framework into an interesting permutation of the map example I gave in the previous post.  You can see a live sample of it here.  I’d never dug that deeply into NVD3 before but I guess I’ll need to tour the inner code.  I probably have a lot to learn from Bob Monteverde.

Now up and onward, lets talk about Pie Charts.

The Pie Chart

The Pie Chart has been the pariah of the data visualization world ever since our well respected data visualization pioneer Edward Tufte condemned their usage.  However, I, and others disagree.  Bruce Gabrielle makes a series of compelling points and provides situations where Pie Charts are an ideal way to visualize relative relationships.  Bruce’s counterpoint is located here.

Personally, I secretly chuckle to myself whenever absolute principles (do’s and don’ts) are provided for on high for data visualization or most anything for that matter.  Data visualization to me is merely a form of communication.  Effective communication involves knowing your audience.  If I were describing a relatively complex idea such as a bubble sort to someone, I would likely explain it differently to a child versus my wife versus a first year computer science student.

We tailor our communication to fit the audience every day without even thinking about it consciously.  Daddy, “Why is the sky blue?”  We do not reply: “Son, everyone knows that the degree of refraction from the blue band of the spectrum is much higher than the red band, causing it to scatter.  Aren’t they teaching you anything at that preschool of yours?”  No!  More likely you will answer the question in a way that starts with a reference to a rainbow, something concrete,  and build from there.  You take the capabilities and experiences of the audience, in this case a young and inquisitive child, and then frame things in a way that is easily understood.

Much like explaining rainbows to a child, proper visualization depends on the target audience.  Sometimes the ideal visualization is a Pie Chart.  It’s tempting to dazzle an audience with spinning nodes moving across the screen in a stunning array of shapes connected by connections behaving like springs, screaming “Behold my magnificence!!!” as the visualization renders.   It’s very tempting indeed, however, if your true goal is to convey information rather than self promotion, don’t do it.  The audience will stare hypnotized at your creation for sure, but the main point will be lost.

Even relatively simple data visualizations such as Parallel Coordinates can be difficult to grasp at first for the uninitiated.  I think that data visualization experts can sometimes lose their grounding in this respect.  I spent the better part of an hour explaining Parallel Coordinates to one of my most intelligent colleague at work only to have him declare it garbage.  But, but, but…?!?!?

These are but some of the reasons why the pie chart can sometimes be your friend.  Everyone is familiar with the construct.  It requires no explaining and it can be good for depicting relative and relative-aggregate ratios.

Ok, enough about that…let’s visualize…

Example #1 : A Simple Sample

Here is a simple pie chart which depicts my feelings about vowels.  Apparently, I love U.  Click it to go to the live example.  Trust me, it looks the same either way.


The code for this amazing feat of visualization:


Example #2 : Pie Multiples

Now let’s visualize State Taxation in the US for Q3 2012.  This example will take the top 3 states in each taxation category and show the ratios in a series of pie charts or pie multiples.  I think this is a pretty neat and effective way to convey information to some target audiences.  Apparently, my state (Florida) is taxing me pretty steeply relative to the rest of the nation.  I am quickly becoming a big fan of small multiples in all shapes and form.


The code for this isn’t much more complex than the previous example.  The only difference is that we iterate through a list of data and calculate our relative offsets and labels dynamically.


Example #3 : Donut Multiples

What’s a donut chart but a pie chart with a hole in the middle?  The code should reflect that simplistic relationship as well.  It does.

The previous example is converted to donut charts simply by changing the ‘innerRadius’ argument from 0 to 50.  Small change in function parameters, large change in visualization.  That’s how it should be.



In conclusion, I think I’ll get back to coding something now…

– Pat


About patmartin

I am a coder and Data Visualization/Machine Learning enthusiast.
This entry was posted in General. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s