The joy of six: easy error bars

Over on the forum, Hadbar asked a question about Error Bars. He asked the question back in the days of version 5, when it wasn’t straightforward to make a pleasant error bar. However, now we have the Joy of Six, we can use the new dual axis/multiple mark features to create some visually appealing error bars:

Tableau won’t calculate the error values for you, so you need those in your dataset. With this example, you need two measures:

  • Error – the magnitude of the error
  • Error lower – the lower limit of the error bar

Here’s how we build the viz. First make a regular bar chart with the relevant Dimension and Measure, as below:

To create the error bar, we build a Gantt chart on the second axis. It’s lower limit is the value of the Error lower measure, and it’s size (height) is the size of the error. Step one is to put the MIN(Error Lower) pill on the Rows shelf, and set it to use Dual Axis (click the picture to see details):

We’ve now got a dual axis graph, but there’s some way to go yet. The Error Bars need to use a different mark type, in this case a Gantt Bar. Right-click on the axis, and choose Mark Type…Gantt Bar:

Set the Size of the Gantt Bar to the size of the error. To do this, make sure the Marks shelf is showing the correct Mark. In this case, it’s MIN(Error Lower). This is a new feature in v6. In case you’ve not seen it, you can page through all the Marks:

Once you have found the correct mark, put the Error measure onto the Size shelf – that creates the Gantt bar with the height of the error. You’ll probably now notice that you have error bars, but they’re wide, and not in the right position relative to the bar. This fat bar problem is easily fixed – just slide the Size slider on the Mark shelf to be the smallest possible. That creates a nice thin line.

How to get the error bars to align correctly? Simple – right-click on the axis and choose Synchronise Axis. While you’re there, you don’t need to show the right-hand axis at all. You can’t properly hide axes in Tableau, but you can format them so they don’t appear. Right-click on the axis and choose Edit axis. Delete the title on the General tab, and in the Tick Marks tab, set the Minor and Major Tick Marks to None. Click OK and your axis has “disappeared”.

Lo and behold – you have some error bars. Play around with widths/colours and other settings to make it appear just how you want it. Coming next in the Joy Of Six series…. using parameters to create dynamic groups.

The joy of six: user-built views

Today is the Joy of Six day. Tableau v6 is incredible, and I’ve been lucky to have had my hands on the beta versions for a while. The Tableau site itself is a great resource for learning about the amazing new features and how to use them. I wanted to do a series of posts about how these new features are already being practically applied to solve our own real world problems.

A common problem we see is that we build a view for a user, only to have them say, “Hey, that’s great, but instead of Profit, can you show Sales? Oh, and also, I’d like to see it broken down by Container, not State”. In the old days (pre v6) you had to build a view for each request. Not now. Oh no. Not now. Now you can build in masses more flexibility into your views.

The dashboard below shows an example using Tableau’s sample data:

How do we do this trick? First let’s look at the pills that build this view.

Instead of using the actual dimensions or measures, each pill is either a parameter, eg “Choose columns”, or a calculated field based on a parameter, eg “Chosen column dim”.

There are four parameters in this view (for more on Parameters, check out this video on Tableau’s own site):

Each of these is a String List, looking something like this:

Each item in the List of values box should be a Dimension (in the above image) or a Measure (not shown) you want to the user to be able to choose. You need a parameter for each user-editable area of the worksheet.  In my example, that’s a parameter for Row, Colum, Bar length, and Colour.

Once you have your parameters, show them all on the worksheet (right-click on the Parameter name and choose Show parameter control).

Our next step is to connect some calculated fields to each parameter. The “Bar” calculated field looks like this:


The IF statement returns a different Measure, depending on the value of the Parameter.  There are four calculated fields – one for each parameter. I created the following for the viz above:

  • Chosen row dim
  • Chosen column dim
  • Bar
  • Colour

Now you can build your view – drop the calculated fields onto the relevant shelf, and you should now have a dynamic view where the user gets to choose what they want to see.

The final thing you should do is format the tooltips, as the default ones will make no sense. See my previous posts on tooltips for some tips.

Download the workbook to explore how it’s done in more detail.

US Sexual Health and Behaviour Survey

Flowing Data laid down the challenge to visual the sexual health and behaviour dataset from Indiana University. Seemed like an interesting topic…. Here’s my attempt:

London 2012 ticket prices

London 2012 published the Olympic ticket prices today. There’s lots of good value seats to be had. I took the data from the London 2012 site and built this viz that you can use to find out how much your favourite sport will cost you:

Note: this viz does not include the Opening or Closing ceremonies. Top price seats for those will set you back a max of £2,012 and £1,500 respectively! Ouch

Visualising golf tournament results

Warning! This post discusses disc golf. If you’ve not heard of it, just imagine I’m referring to “normal” golf.

The US Disc Golf Championships, the world’s toughest, and richest event is happening this week. The leaderboard’s on the PDGA.com, and on the USDGC sites are ok, but don’t reveal very much.

Here’s my leaderboards, made using their data. The first shows the ranks of the players, showing you how many birdies and bogies they got. You can click on a player, or multiple players, to see how they did in each round (this viz will be updated as round scores are available; you may only see Round 1 scores for a day or so):

The second viz shows how we can use the data to analyse things other than players. Because we know how everybody scored on every hole, we can adapt the viz to analyse each hole, and see which played the hardest or easiest:

Both of these dashboards can be seen in full screen. Click here for the player dashboard, and here for the hole-by-hole dashboard.

Telecoms companies: who’s suing who?

There’s a chart doing the rounds that shows who is suing whom in the telecoms industries (eg at the Guardian). David McCandelish has improved it nicely here, and asked the question of whether companies who’s revenue is going down are more litigious than those on the rise. Well, I took his data from here and created the charts below.

There are lots of caveats: I excluded Smartphone Technologiess LLC because the data didn’t say if their revenue was up or down. That’s a shame, because they’ve got the most lawsuits open. Also, we don’t know if the revenue was going up or down when the lawsuit was started.

PS – for Tableau geeks, the tooltips on the chart are using my Conditional Formatting trick (click here) to make the text colour change depending upon Revenue Direction.