VizWiz

Launch, grow, and unlock your career in data

February 14, 2013

Pie charts duel to their death: Create slope graphs as an alternative in Tableau in five steps

9 comments

UPDATE: Thanks to a reader for noticing that I had the years in my data set backwards.  I have corrected the data and updated this blog post.


Consider this recent chart by Business Insider that attempts to compare data across time and contributions to the whole with multiple pie charts.

It’s not worth words to review how horrible this chart is given the message it’s trying to convey.  Instead, consider slope graphs.  Download the data for this example here.

image

I’m assuming that you know how to connect to the data in Tableau.

Step 1 – Drag Measure Names to the Columns shelf

Step 2 – Drag Measure Values to the Rows shelf

image

Step 3 – Drag the Number of Records measure off of the Measure Values card.

Step 4 – Change the mark type to Line

Step 5 – Drag the Shopping Category dimension to the Level of Detail shelf

image

You’ve just created a slope graph in Tableau in about 20 seconds.  Does this make the data easier to compare?  Sort of.  You see some lines that go up and some that go down, but the chart need more detail to make it easier to understand.

Step 6 – Format the measures and axis to be percentages.  Also remove the “Value” title from the axis while you’re at it.

Step 7 – Drag Shopping Category to the Label shelf and set the labels to show only on the start of the line.

image

Step 8 – Create a calculated field to identify the categories that increased or decreased.

image

Step 9 – Drag your calculated field to the Color shelf and adjust the colors to your preferred color scheme.

image

Step 10 – Add markers to the end of the lines

image

Does a slope graph communicate the message better than the pie charts?  Absolutely! 

image

You can easily see the winners and losers:

  • Retailers have increased significantly, nearly double the time spent as the previous year.
  • Online shopping and Daily Deals appear to have lost most of their mobile time spent shopping to Retailers.

Are these relationships seen as easily in the pie charts?  No chance!

Download the Tableau workbook here.

9 comments :

  1. Thanks for explaining the steps for drawing slope plots in Tableau. My preference for these data are to use arrow plots. See http://onforb.es/MTFOZY

    ReplyDelete
    Replies
    1. I remember reading that Naomi. Unfortunately Tableau does not allow you to put arrow heads on the end of the lines.

      Delete
    2. See the arrow chart by Joe Mako in www.forbes.com/sites/naomirobbins/2012/12/21/visualizing-the-table-of-the-graph-makeover-contest-2/

      Delete
  2. I love the way you've demoed how to show this data much more effectively in Tableau, though my initial observation from the chart was that retailers have increased significantly rather than decreased... looks like there's been some mis-labelling of the data as you seem to be reporting 2012 figures in the pie chart as 2011 data and vice versa....

    ReplyDelete
    Replies
    1. Thank you, thank you, thank you! I have fixed the data and corrected the blog post.

      Delete
  3. Andy,

    Great posting!

    Another option is to color the lines based on the "Difference vs Previous" month (using a quick table calculation).
    It does require a bit of data reshaping.

    Thoughts?


    http://public.tableausoftware.com/views/BusinessInsider-SlopeGraph/Sheet2?:embed=y


    ReplyDelete
    Replies
    1. Santiago, I don't think this works because all of the lines start at the zero (gray) color then at the other end only show the correct color. I like your thought process though.

      For mine, all I wanted to show was whether the categories increased or decreased. The slope of the lines provides the insight into the amount of change.

      Delete
  4. Andy,

    Thanks for sharing your thoughts. Your comments are very valid.

    Your shared a solution for pivoted data (value in different columns). Sometimes the data is in stacked format(value in one column).

    In case someone is creating a slope chart, and has their data stacked,I am sharing a solution using stacked data (the formula is a bit more complex, using window formulas).
    http://public.tableausoftware.com/shared/GDMRP7FR7

    ReplyDelete