VizWiz

Launch, grow, and unlock your career in data

July 16, 2012

Tableau Tip: I’ll take you to the candy shop. I’ll show you how to make a lollipop.

10 comments

I’ve been gone for a few weeks enjoying some much needed time off before changing jobs and moving to the west coast.  I’m hopping back into the blog saddle with a series of posts about different charts type, their strengths and weaknesses, when to/not to use them, etc. 

The posts will include step-by-step instructions for creating the charts in Tableau.  The instructions for many of these charts have been written before and I will reference the authors whenever I know about their work.

I will typically use a chart I’ve found on the internet in order to provide variety of examples and also to provide a forum for discussing the strengths and weaknesses of their chosen designs.

Let’s get right to it with this lollipop chart from The Washington Post (via Chart Porn):

I like the clean design, the use of simple colors, and the excellent use of data-ink ratio of this chart, but there are few issues that immediately stand out to me.  First though, what is a lollipop chart?

I couldn’t find an exact definition, but I think of a lollipop chart as a combination of a bar chart and a dot plot.  Lollipop charts are great for giving you a sense of both length (bars) and precision (dots). 

However, it only makes sense to use the stick of the lollipop when you’re range starts at zero. 

In the example above, the bars start at 60, therefore including the bars could mislead the reader into thinking the retirement age in Malta is five times lower than Austria. In this example, the bars should be removed, which turns the chart into a dot plot.

Another problem with this chart is that there is no particular rationale to the sort.  At first I thought it was ranked buy retirement age from youngest to oldest, but then Spain was listed before the United States.

For the purpose of the rest of this blog post, we’re going to focus on the retirement age only.

Taking the issues above into account, the data could be represented as a simple dot plot:

image

Or alternatively as a lollipop chart:

image

Hopefully at this point you understand when and why you would use a lollipop chart.  In the end, it’s basically a bar chart with a bit more emphasis on the exact value of the bar.  CAUTION: Don’t avoid a bar chart simply because a lollipop chart looks cute.  I would nearly always prefer a bar chart over a lollipop chart.

So now onto the instructions for how to build this chart.  (Credit to Andy Cotgreave, who back in his days at The Data Studio wrote similar instructions)

Step 1 – Drag the Country dimension onto the Rows shelf and the Retirement Age measure onto the Columns shelf.  The result is a bar chart.  Click the sort ascending button.

image

Step 2 – Drag the Retirement Age measure to the Columns shelf again.  The results is the same bar chart side-by-side.

image

Step 3 – Right-click on the 2nd Retirement Age measure on the Columns shelf and choose Dual Axis

image

Step 4 - Right-click on the 2nd Retirement Age measure on the Columns shelf and choose Synchronize Axis

Step 5 - Right-click on the 2nd Retirement Age measure on the Columns shelf and uncheck Show Header

Step 6 – Drag the right side of the chart to the left to shrink the view

image

Step 7 – On the Marks card, click on the triangle (a.k.a. carrot) on the upper-right and choose Multiple Mark Types

The Marks card should now show “All” at the top and there are now arrows for moving left and right through the measures on the Column shelf, e.g., the two Retirement Ages measures.

image

Step 8 – Click the right arrow on the Marks card once, then:

  1. Change the format of the chart from Automatic to Bar
  2. Move the Size slider all the way to the left to make the bars as small as possible
  3. Remove the Measure Names field from the Color shelf
  4. Change the color of the bar by clicking on the colored square.

image

Step 9 – Click the right arrow on the Marks card again to move to the 2nd Retirement Age field, then:

  1. Change the format of the chart from Automatic to Circle
  2. Remove the Measure Names field from the Color shelf
  3. Drag the Retirement Age measure onto the Label shelf
  4. Format the Label to the font color of your choice and set the horizontal alignment to Center to place the label in the middle of the circle
  5. Change the color of the circle by clicking on the colored square
  6. Resize the circle

image

Voila! You’re lollipop chart is complete.  After you practice these steps a few times, you’ll be able to build it in under one minute…guaranteed!

image

Download the Tableau Workbook here.

10 comments :

  1. Step 8.2 should read move slider to the left.

    Great tutorial though!

    ReplyDelete
  2. Thank you, great tutorial :) Is there a way to build a lollipop viz where I have two circles with bars in one line? When i try that I always get separated tables.

    ReplyDelete
    Replies
    1. Not sure what you mean. Can you post a picture of what you're trying to do?

      Delete
    2. I have created these two visualizations: http://i.imgur.com/3eKDyct.png

      But I would like to have a look at it as in your example by the Washington Post:
      http://i.imgur.com/qZ8vv0F.png

      Instead of "2012" and "longterm" I would like to have "women" and "men" in one line. Is that even possible?

      Delete
    3. Sure, you can dual axis them. Put men and women both on one axis with shapes and just women on the other axis as a bar.

      Delete
    4. Thanks, unfortunately if I do that (still already a progress) both - men and women - are automatically getting the same shape.

      Delete
  3. Link to the attached workbook is not working.. :(

    ReplyDelete
  4. Link to the attached workbook is not working.. :(

    ReplyDelete
  5. Hi Andy,

    Amazing article.

    But the workbook URL is broken. Would you please fix it?

    Thanks..

    ReplyDelete