My consolidated list of chart types includes a dedicated blog post for diverging bar charts, but a number of #MakeoverMonday submissions this week piqued my interest in a variant of the form, whereby a central space between the bars is allocated to be used as a central axis. That is probably the least articulate sentence you will read this week; here’s what I mean:
Now you can see what I was referring to. Both examples contain a blank central pillar which contains the Date Dimension. If you want to try to recreate it, the original dataset is here, on Andy’s blog (week 30): http://www.vizwiz.com/p/makeover-monday-challenges.html
I saw these examples, plus a couple more, when searching the #MakeoverMonday hashtag on the commute home from work (alongside some reupholstered chairs, a sliding driveway gate installation and some terrifying make-up). I thought: “That seems pretty easy, I’ll have a go when the kids are asleep”:
It’s not wildly out, but there are a couple of things to fix:
- I created a diverging bar by creating a basic calculation to make the Male values invert, but this has a knock-on effect to the x-axis labels and the labelling of each bar. How do I resolve this?
- How to get that central pillar so I can move the y-axis labels into the middle?
This is where the Tableau Community is great, and where Tableau Public is such a great learning resource. Let’s open Katie’s viz and address these issues.
Sorting out the labels and axes
Doh! As soon as I opened the viz, I right-clicked the dashboard to “Unhide all sheets”, expecting to see a single worksheet packed with cunning solutions. I was wrong:
That’s right. Three sheets. Lots of things suddenly become very clear. The Female tab just plots the Female census data in a horizontal bar. Simple. If you use a discrete Year you fill the space better than if you max out the size of the bars with a continuous date.
The Male tab reveals the error of my ways when using the “Negative Male” calculation linked above. All it actually entails is the exact same methodology as the Female tab, but with the axis reversed(!) Bloody obvious with hindsight and it avoids all of the issues with axis labels. Here’s how it looks when I recreate it in Tableau 10 Beta without modifying the axis:
And this is it with the axis reversed:
With axis reversal easily achieved by right-clicking the axis and ticking the “Reversed” box:
Progress! What about that pesky central pillar? I literally had no idea how to achieve this, so let’s look in more detail at Katie’s “Year” tab.
Oh? How much have I been overcomplicating things in my head?! Time to check Andy’s workbook out:
Aha! Fiddlier! But why? At this stage, I had no idea. I looked at the dual-axis and tried to see what it added. Nothing obvious stood out, so I removed the second axis, and this happened:
A barely perceptible shift in the vertical positioning of the Year. With a dual-axis it was tighter, but not to the extent that I could see warrants this additional complexity relative to Katie’s submission. OK, let’s finish things off by building the “Year” tab and bringing the three elements together.
I haven’t gone to town with formatting here, but it’s a reasonable approximation of the original submissions by Katie and Andy.
In the process of building the final dashboard, I came to realise (perhaps) why Andy used the fancy dual-axis “Years’ tab that he did. Well, I don’t know exactly how it achieved what it did, but watch what happens when I used Katie’s method in Andy’s viz – crudely formatted so you can see it!
The vertical alignment is all over the shop. When I recreated the viz using Katie’s method, I had to use the same workaround as she did – I added a small blank object at the foot of the “Years” tab on the dashboard to force things into alignment. Andy’s method avoids this workaround. I’m not certain of the reason for this, but the underlying calculations are very basic:
Seems like the use of the average of zero on a dual-axis somehow achieves horizontal and vertical alignment?! I don’t know the specifics so will just label it witchcraft. If someone does know the science behind this little trick, please share and I’ll update the post accordingly.
EDIT! It is not witchcraft: