Thursday, March 27, 2014

more on slopegraphs

Note: only a couple spots remain in my upcoming San Francisco storytelling with data workshop. Details and registration can be found here.

I am a fan of slopegraphs. I first used one after reading about them in Alberto Cairo's The Functional Art back in 2012 (my related blog post is here; scroll to the second half for the section on slopegraphs). More recently, I created a slopegraph template that is available for download here. I find myself frequently using slopegraphs to illustrate a novel and often easier-to-show-interesting-insights-than-alternative-visualization-methods approach.

Typically, I find myself using slopegraphs to compare two points in time. I love that, in addition to the absolute values (the points), the lines that connect them give you the visual increase or decrease in rate of change (via the slope) without ever having to explain that's what they are doing, or what exactly a "rate of change" is - rather, it's intuitive.

Slopegraphs can also be useful to show comparisons between groups. For example, when reporting employee survey results, a slopegraph can be used to show a given team's feedback across survey categories compared to the overall company, as illustrated below.

I originally had mixed feelings about using a slopegraph in this way. After all, a slopegraph is a line graph, right? And I've always taught that line graphs should only be used when plotting continuous data, which isn't the case here. But I think the main reason for making sure lines are plotting continuous data is to ensure that the lines that connect the points make sense. And in this case, they do. The lines visually display the relative difference between the two groups.

In fact, a slopegraph allows us to visualize data in a way that makes easy quite a number of observations and comparisons. While doing a bit of research on the topic, I came across Charlie Park's website, where he has a couple of posts devoted to slopegraphs (that include a number of great examples from the media and elsewhere). In his first post on the topic, he recounts Tufte's list of what slopegraphs are useful for showing. Below, I've listed these, applied to the above example:
  • The hierarchy of survey categories, both for the company and Team X (relative order of points on left and right, respectively),
  • The specific numbers associated with both groups (the data values),
  • The difference for each survey item between the company and Team X (the slope of category's line),
  • How each category's difference relative to the company compares to the other categories' (the slopes of lines compared with one another), and
  • Any noteable deviations in the general trend (aberrant slopes).
Rephrasing this final point in simple English, slopegraphs can sometimes make things that would otherwise be difficult easier to see. Let's look at an example to illustrate this point.

I am an oft-recommender of the horizontal bar chart, but recently encountered a situation where a slopegraph trumped one. I was looking at alternate ways to visualize some data for a custom workshop I was conducting. Again, we are looking at survey data, this time feedback from customers across a number of survey items in 2011 vs. 2010.

I started out with the following bar chart (note: this is a genericized version of the original):

As you scroll down, taking in the data from top to bottom, we can see for each survey item, how 2011 compares to 2010. There's something possibly interesting near the bottom: Survey item I is the only place where we see a marked decrease from 2010 to 2011. This gets a bit buried in the above visualization. 

If there's a story there we want to focus on, we could highlight the relevant data points to draw attention there:

In the above, now it's a quicker process to get to Survey item I because of the preattentive attribute (color) that we've leveraged to make those data points stand out from the rest. But perhaps we can do better.

Next, let's take a look at what the same data looks like, visualized with a slopegraph:

In the above, a couple things jump out at me quickly (more quickly than they did in the horizontal bar graph): the increase over time in Survey items A and B, and the decrease in Survey item I. Per Tufte's list discussed previously, we can also easily see the rank ordering across the various survey items in 2010 and 2011, the specific data values, and the change over time, both for an individual survey item, and for the survey items compared to each other. In this example, I find that nearly all of these aspects are easier to see when visualized as a slopegraph than they were in the original horizontal bar chart.

Again, with this setup, we can use color to draw attention even more quickly to Survey item I if desired:

To complete the above visual, we'd likely want to add some text explaining why the points we're highlighting are interesting, relevant context, and perhaps a call to action. I've genericized the example a bit too much to actually do this here, but you can imagine what that could look like.

In conclusion, when you find yourself comparing two groups across the same dimensions, or plotting two points in time: think about whether a slopegraph might allow you to visualize your data in a way that would be intuitive for your audience and make what you want to highlight easy to see.

For even more on slopegraphs, check out the following:

No comments:

Post a Comment