Friday 7 June 2013

Tableau Worm Charts - a European Conference Special

I can't remember exactly the first time I saw the amazing Hans Rosling doing his thing with global  public health data and moving bubbles (I think someone sent me this link http://www.ted.com/talks/hans_rosling_shows_the_best_stats_you_ve_ever_seen.html about 3 years ago) but I remember how inspired I felt. Hans could have showed that same data with two sets of line charts with time on the x-axis, but instead by making time a third dimension that moves he made the visualisation so much more engaging and powerful.

When I first started using Tableau (also around 3 years ago) one of the first things I tried to do was replicate what Hans Rosling had done with the data I was using at work. And with the Tableau European Customer Conference right around the corner featuring none other than Hans Rosling as a key note speaker, this seems like the ideal time to tell that story, and to introduce The Worm Chart!

I'm going to run through this explanation with a fictional data set, but one that mimics quite well the behaviour I see in my job at a retail bank. The data set includes ages, number of customers, savings balances, customer income and proportion of customers with a mortgage. I want to investigate how those variables change with age.

The first thing you need to do to make a bubble chart of course is produce a scatter plot. So place a Measure onto Rows and another onto Columns:

Next I want to split the scatter plot up into bubbles based on Age. So I next move Age from Measures to Dimensions:

Now if I were to go on and produce a moving bubble chart like Hans, I would place Age into Pages, maybe add some colour and size options and hit play. However most of the time I don't get to show my colleagues a dashboard in a setting where I can press play, often charts get put into Powerpoint and currently Tableau Server doesn't allow Pages to work in the same fluid way as Tableau Desktop. So I found a way to add the impression of movement in a static image. First by adding Age to Colour I can split up the bubbles:
This is still a little unclear, so to make things clearer I change the mark type to Circles, I add number of customers to Size and crucially use the Cyclic colour setting which perfectly shows the gradual changes     as age increases:

It is now very clear how these variables, Income and Savings, are changing with age from the younger ages (green) where both are low, through to middle age (yellow) where income is high but savings moderate and past retirement (pink) when income reduces but average savings increase. This is The Worm Chart! One of the benefits of this type of visual is also how easy it is to spot changes that are out of sync with the usual gradual change. In the example here you can see how there is a jump in savings when customers hit 65, i.e. common retirement age. That kind of jump just doesn't stand out as much in a line chart. You can also spot outliers, like the very young and easily exclude them:

And then maybe throw another Measure onto rows or columns to show two worm charts at once:

So that's the worm chart, its a fun and engaging way of showing data in instances where things change gradually with time and you want to demonstrate the cyclical nature of the data or highlight where it skips.
You can expand on this by adding a top tier dimension into Colour ahead of Age (in Hans Roslings case that dimension would be Country) to create multiple worms in the same pane. And to really take things to the next level produce Parameters to allow users to choose different measures for the X and Y axis. Which is exactly what @datajedininja and I will be demonstrating at #TCCEU13.........



PS - I'm sure I'm not the only person to have done this, so apologies to anyone who's done this for years and is thinking 'so what', but I thought it would be new and interesting to a lot of people.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.