Comets are in the news. How about in dataviz?

The Rosetta is about to attempt to land on a comet. This is astonishing and exciting. Here’s some incredible photos of the comet on the New York Times. In honour of this event, here’s a post about comet charts:

If only I’d gone vertical and not stayed with horizontal.

I saw this tweet today:

“Comet chart”? But… But…. But…. I came up with that idea in 2012. How dare they steal my idea.

What? You’ve not heard about my comet charts before?

That’s fair enough: they were a doomed experiment several years ago and only ever seen in a thread on our Tableau Community. Below, in its non-intuitive glory is my comet chart:

Horizontal fail
Horizontal fail

(Before I continue I’m happy to acknowledge other reasons you might decide the above dashboard doesn’t work)

Zen Armstrong’s version succeeds where I failed. Her up-down orientation fits in with ones mental image of growth/decline and gravity. If only I’d thought about trying that. In order to make my chart more readable, all I needed to do was orient the marks differently:

The marks are more readable
The marks are more readable

I focused too much on horizontal orientation in order to ensure the labels were readable. Once I’d made that design choice, I was stuck with it and didn’t see the simple change I could have made. Orientation was even something I talked about in the thread where I posted this content.

What’s the lesson? Don’t get stuck in your viz too much. Be ready to keep trying  changes. Get feedback and keep experimenting.

Congrats and thanks to Zen Armstrong for coming up with her approach.

Designing a line chart for seasonality

A time series focussing on seasonality
A time series focussing on seasonality (click here to see and interact with the full dashboard)

This month I am focussing on design decisions made on my VizWhiz dashboard. In this post, I’m going to talk about the designing time series line charts to focus on seasonality.

Note: there are other ways to show seasonality, such as the highlight table in the centre of the my dashboard. Andy Kriebel has done the best post about this approach using Tableau; I recommend you read that post.

Back to my chart. Here’s the default:

default

In order to emphasise the seasonality, I made 7 decisions, each of which is explained below.

  1. Draw one line for each year
  2. Use moving average
  3. Add an Average reference line
  4. Use a gradient colour for a subtle indication of years
  5. Add annotations for clarity
  6. Create a custom  legend
  7. Add dots

1. Draw one line for each year

I have written about seasonality before (click here). In this case I wanted Months on the x-axis with a line for each year. That’s very simple to do – just move the dimensions into the correct place:

[Month] on Columns, [Year] on Mark shelf
[Month] on Columns, [Year] on Mark shelf
This gives us a line for each year in the dataset. It’s a nice clear display of which months see the most fatalities.

2. Use moving average

The peaks and troughs are a little bumpy. To smooth out the experience for the end user, I used a moving average. You can see the differences below. The left hand side is easier on the eye and thus the story is easier to digest.

with or without moving avg

I don’t state anywhere on the view that I am using a moving average: I acknowledge that my view is slightly misleading. The tooltip, however, shows the actual value, not the moving average.

3. Add an Average reference line

The thick line is the average for each month
The thick line is the average for each month

The average reference line adds more context to the view. In this single view, you can see each individual year and also get the overall picture of fatalities during each month.

This is documented in a separate post as it’s quite complex.

4. Use a gradient colour for a subtle indication of years

There are too many colours in the chart above. You could put [Year] on the Detail shelf to have just one colour:

Moving Year to the Detail shelf
Moving Year to the Detail shelf

This is ok but it’s hard to see any change between years. I chose to add a subtle colour palette. This indicates there’s a difference between each line but one that’s subtle.

To show the changes I:

  1. Put Year on the colour shelf and chose a red palette
  2. Reduced the size and increased the transparency:
    Colour and size

5. Add annotations for clarity

Now that I have a line for every year and for the average fatalities for each month, I needed to clarify things a little. I annotated values in the upper and lower area of the chart. These provide context for the user.

6. Create a custom legend

legend made in powerpoint
This legend was made in Powerpoint

Tableau won’t create a legend to show that the thin lines are single years and the thick line is an average reference line. I created that in Powerpoint (hat tip to Mark Jackson) and floated the image on the dashboard.

 7. Add dots

dots on average
The dots emphasise the difference between the average and the individual year lines

The final piece was to put dots on the average line. This gives an extra indication that the average line isn’t the same as the fine lines.

dots on colour shelf

I’ve always liked this little feature. It emphasises the marks for the average line, allowing the individual years to further blend into the background.

Conclusion

A time series focussing on seasonality

A time series focussing on seasonality

My end result? A chart, I hope, emphasises not only the seasonality of fatalities in the US, but also gives us a better sense of the data by showing individual years, too.

What do you think? Were my design decisions appropriate?

The full dashboard is available by clicking on the image below:

My entry - click to see it bigger
My entry – click to see it bigger

Adding an average reference line in seasonality charts

A time series focussing on seasonality
A time series focussing on seasonality. Click here to see and interact with the full dashboard.

See the thick line in the chart above? That shows the average number of fatalities in a month for all years in the dataset.

It’s the equivalent of drawing an average reference line for each cell in the view, which you can see below:

Using Average Reference Lines
Using Average Reference Lines

The reference lines are quick and work, but they’re not attractive and are a little difficult to interpret.

To draw the line you need some table calculations.

I’ve recreated the chart using the sample Superstore data and you can see the workbook by clicking on the image below:

Click the image to view the workbook
Click the image to view the workbook

Making the average line

To make this chart, I start with a basic seasonality view: [Month] on Columns, [Year] on Colour/Detail shelf.

I then need to work out the window average in each month. here’s the calculation:

window average

Drop that onto the Row shelf and set the Compute Using settings as follows:
compute using for window average

Now you should have a chart with the regular measure and the average calculation on the Row shelf. Right click one of the measures and choose Dual Axis. Then right-click on one of the axis and synchronise them.

That’s the basic chart done. I had to tweak the Colour, Transparency and Size a little to get a result I was happy with.

An anti-aliasing problem

This is pretty much complete.  But there’s one thing that’s niggling. The average line is jagged:

I can't help but hate anti-aliasing
Argh! Jagged edges!

What’s going on here? Well our average line is actually multiple lines, one for each year in the dataset, drawn on top of each other.

How do we solve that? I created a new calculation:

FIRST()==0

If you set this with the same Compute Using… setings as the calculation above, you get a True/False value. The True value is applied to just one of the lines being drawn on the chart.

Drop this field on the size shelf, right-click on the False mark in the legend, and choose Hide.

Hide false

This solves the anti-aliasing problem and makes the view that small but significant bit nicer to look at.

Conclusion

As you can see in the image below, what I’ve achieved is the equivalent of doing a per cell reference line, but made it much more attractive:

My solution on the left. Default reference lines on the right
My solution on the left. Default reference lines on the right

What do you think? Is this the best way of showing seasonality? Is there a more efficient way of doing this using simpler calculations?

Click the image below to see and play with the complete workbook:

My entry - click to see it bigger
My entry – click to see it bigger

How to design an axis for maximum impact

Axes designed for ease of interpretation
Axes designed for ease of interpretation. Click to see the full dashboard.

When visualizing data, should you leave the axes at their default settings? Almost always the answer is no. The defaults won’t be bad, but I’d bet you could always improve the viz by changing them.

This is part of a series of posts about dashboard design, focussing on choices I made in this dashboard. All of the axes have been altered very deliberately.

In this post, I will first explain the different choices I made. If you want to do these in Tableau, they can all be done via the Edit Axis dialog box (see the help page here)

Here are the design principles I followed:

Don’t show zeroes. 

My story focusses on relative change over time, so I did not show zero in any of the y-axes. You can find out more about the guidelines on including zero here.

with or without zeroes
Without zero on the left: that’s better, right?

Remove axis labels where the measure is obvious. 

Do you need “Year of accident” or “Year” on an axis when it’s obvious what it shows? I’d say no. Do you need to label your y-axis with “Fatalities” when you’ve got it in the title? I’d also say no. You can see how it looks with and without the titles below. Which do you prefer?

with or without axis titles

Show the fewest tick marks you can.

In the image below, you can see the difference between lots and few tick marks. Neither of these are bad but I felt fewer tick marks helped focus on the trend in the data
Which is clearer? Lots of tick marks or fewer tick marks?

Set the axis range so that relevant, round values are shown.

Check out the difference between the default axis on the time chart (lower chart below) and my edited version (upper chart) It’s easier to start your eye at 1975 than it is at 1983:

Compare the default date tick marks to my final ones
Compare the default date tick marks to my final ones

In Tableau, getting round values in your default dates is a little trickier than you might expect and for full control you need to master the Edit Axis box. I will blog that separately.

Conclusion

Those were my design choices in this case. Was I successful? Let me know. Remember: none of these are mandatory changes and I don’t even suspect everyone would agree these are improvements to the originals – it’s partly subjective and partly depends on the goal of your viz.

My entry - click to see it bigger
My entry – click to see the interactive version

Are our defaults at fault?

Here are two dashboards. The bottom one uses all Tableau’s default formatting settings. The top one has at least 25 formatting changes or design decisions: these changes take a few hours to implement. Why bother? What’s wrong with Tableau’s default formatting?

My entry - click to see it bigger
At least 30 design choices were made to make this!  – click to see it bigger
100% default formatting
The same dashboard with zero formatting changes: it’s 100% Tableau default

The short answer is: nothing. The longer answer is more nuanced.

It’s Tableau Public’s Design Month so I wanted to do a series of related posts. In these posts, I’ll be focusing on the dashboard above (click here for bigger version). This was my entry into Tableau’s annual internal “VizWhiz” competition. In this round, we were given data was about US road traffic accidents.

There are at least 25 things design decisions I’ve made to produce that viz. That’s 25  changes I have made to the default Tableau formatting: some small, some large.

But first: why change the default formatting? What’s wrong with Tableau’s defaults?

Let’s look again at the default dashboard:

100% default formatting
100% default formatting

Let me repeat: There is nothing inherently wrong with Tableau’s defaults.

My story can be understood from the default dashboard above. In fact, I am sure some people reading this will think the defaults are better than my design. If so, let me know in the comments below.

So why bother? Why would I spend hours tweaking what is already a perfectly-fine dashboard?

Chris Hoy (Image: BBC)

I take my inspiration from ex-British Cycling performance director Dave Brailsford. He led the British Cycling team to huge success through his “marginal gains” (click here to find out more). The principle is that you make all the small and large changes you make. Even the small changes, when aggregated, make a difference.

Each formatting tweak might only improve my viz a tiny bit.

The default formatting gives you a bronze-medal dashboard. There’s no shame in getting a bronze medal for something. If you’re in a business environment, producing dashboards for fast, iterative consumption, it is perfectly fine to leave the defaults as they are.

However, what if you want the Gold medal? In this case, you make all the changes you can. Even if they are small, the aggregate effect is significant. For that reason, I am happy to go the distance and make grab every “marginal gain” that I can.

Over the next month, I’ll be describing most of the formatting and design decisions I made.

Humblebrag alert: I am pleased with my dashboard but am wide open to criticisms about it. I am sure that what I think are good decisions might well seem like bad ones to you)