I’ll be honest: none of the submissions for #MakeoverMonday this week have blown my socks off yet. Normally I start to write a #TakeapartTuesday post on a Sunday or Monday as the early quality is so high that at least one viz really hits home with me. This hasn’t been the case yet, but I still learned a couple of things that I want to reinforce with a blog post.
- Dual axis line / area charts
These have been a common chart type this week, so I thought I’d briefly show how quick and easy they are to create, as they are nice charts but they aren’t documented that often.
To directly apply the overarching concept to #MakeoverMonday this week, I first created a date field from the fields we were provided with:
I set that to Continuous, put it on Columns as a Continuous Month-Year, and then wrote the Gold / Oil Ratio calc that pervaded submissions this week:
Plotting that on columns (and excluding data prior to March 1983 – to exclude months prior to oil prices being recorded) yields this:
Once you plot the [Gold:Oil Ratio] as a dual-axis, synchronise the axes and hide the secondary header, it all looks rather similar:
The “trick” is simply to use the Marks Card to alter the view. In this instance, both axes are set to Line, but look what happens if you set one axis to be an Area chart instead:
It’s that easy. Some formatting will quickly get you to a nice end product. I know this will elicit shrugs from intermediate and beyond users, but it has cropped up at work and prompted a few “Oh – yeah – I see that now!” responses so I feel it still warrants some airtime for newer Tableau users.
2. Formatting reference lines
The catalyst behind this post was Andy Kriebel’s submission, as his was as good an example as any this week. Downloading his viz opened my eyes to another small Tableau quirk which can be overcome easily but isn’t immediately obvious. Observe Andy’s chart structure:
Isn’t that quite cool? I didn’t immediately assume that it would be a single sheet, but it is. A dual-axis at the top followed by a single-axis chart below. Nice way to share a single horizontal axis, but I digress……
More importantly, I want to draw attention to the reference lines on the topmost chart. There are a few things to note here. First, the average of 16.4 is a reference line on its own. Second, so are the standard deviation reference lines. Here, I had assumed that Andy had used a Distribution:
But when you do that, you lack full control over the Custom label. What do I mean? Well if I’m plotting -2 or 2 standard deviations, I can’t easily adapt the label to reflect that when a Distribution with negative and positive values is used.
Instead, I need to plot each standard deviation distribution separately, and then leverage the Custom label like this:
One for -2 Standard Deviations, one for 2 Standard Deviations, and then simply a single Reference Line for the overall average:
Hold on a minute! Why are the labels appearing on both the left and right of each Reference Line? It’s because it’s a dual-axis. I didn’t know how to resolve this to ensure that only one label per line was shown, so I referred to the ever-useful Tableau forum. The solution is to edit the Reference Line and align the labels to the side you prefer:
A simple solution, but I have no issue admitting that I didn’t know about it! Tiny tips, but hopefully they add up.