Truii data visualisation, analysis and management tips and tricks category chart

Make great line charts

time-series-line-120x120A line chart or time series chart is used to show a trend over time. The X (horizontal axis) represents time and the Y axis represents values. A line chart usually has each point in a collection or series joined by a line.

We like time series data in Truii and we use a lot of line charts to display our data. There are no hard and fast rules about line charts but there are a few issues to consider so they are easier to interpret.

Zero based Y axis

Some data viz experts are adamant that Y axes should always be zero based – no exceptions (see a nice summary by Justin fox). The argument for a zero based Y axis is that you should show the whole data – any truncation can be deceptive. The argument against always using a zero based Y axis is that you waste a lot of empty space below the lowest value and you cannot highlight subtle variation which may be the point of the story.

Figure 1 shows the same data as two series with the second (blue) series plotted with a non-zero based secondary Y axis. Clearly the non-zero based series suggests a much more dramatic rate of increase in gambling expenditure.

I suggest a basic pragmatic approach for creating any visualisation – be honest with data – use it to inform not deceive. It you think there may be a chance of deception it is worth pointing out to the reader that the axis has been truncated.

The default behavior in Truii is to have zero based Y axes. The dragable zoom functionality allows the reader to zoom in and create their own vertical and horizontal scale.

Figure 1:The same data – the secondary axis has a non-zero Y axis which exaggerates the slope of the line

Using secondary Y axes

I’m not a big fan of secondary Y axes – they can create confusion. However, sometimes real estate is limited and it just makes sense to overlay data which has a common time step but different units. For example I want to show how closely the phosphorus concentration in water follows the turbidity (a measure of water clarity) in Figure 2.

The only real rule for secondary axes is that the secondary axis should have different units or at least cover a different order of magnitude range than the primary axis (i.e. never make charts like Figure 1 above with both axes representing the same thing and covering overlapping ranges).

Figure 2:Using a secondary axis to show how two paramters track through time

 

Join the lines or leave gaps for missing data?

To create a line chart we start with discrete points and then join each of those points with a line. This implies that there is a continuous (and linear) transition between the points. It also implies that our data is sampled frequently enough to assume that joining the points with a straight line is a reasonable approximation of what is happening between samples. Data is almost always incomplete – so what should you do when there are gaps in the data?

If nothing exciting happened during the missed sample then a straight line is fine. However if you are unsure, or suspect some variation then allow the line to be broken for the missing data. In Figure 3 several sites were not samples during late 2012. You can see from the sites that were sampled that there was a spike in phosphorus for that month. Hence it is prudent to leave a gap (rather than join the October and January values with a line).

If leaving missing data as gaps, this raises a problem as to how to display single values with gaps either side. The ‘SGM1’ series in Figure 3 shows this by simply showing the points – you can see an isolated sample as a green point.

Figure 3: Missing data – leave gaps for missing data and show points to highlight isolated samples

 

Stacked line charts

When you have a data set that illustrates the component parts of something through time, the stacked line chart is an informative way to show both the overall trend as well as the trend in the component parts (Figure 4). When creating the stack it is worth considering the order of the series in the stack. I prefer to sort the stack (largest to smallest or smallest to largest) because I think it makes the chart easier to read at a glance.

Figure 4: Stacked line chart

If you are focused on the trend of the change in the relative contribution of the component parts you can always scale the Y axis to show proportions (Figure 5).

Figure 5: Stacked line chart scaled to show proportions

 

Making a line chart in Truii

As with all Truii data visualisations, line charts are made by first creating a Dashboard and then adding your line chart to the Dashboard.

To create your own great charts join for a free Truii trial account.