12
$\begingroup$

This is a data visualisation question - I hope it's okay to ask this here.

When is it appropriate to use a fill under a line graph for a time series, like the graph below? (which is showing ping times over a day)

Line graph with fill underneath

I guess it's more common to use a plain line, with no fill beneath, but is it OK to use a fill for visual variety?

I'd be particularly interested in knowing about any perceptual research on the topic, or any style guides.

$\endgroup$
  • 1
    $\begingroup$ If 0s is the natural lower bound and you show it, then why not? $\endgroup$ – ttnphns Jan 3 '14 at 12:16
  • 1
    $\begingroup$ Ask another way - why use fill if it is not necessary? Imagine you want to add another trend line and things get unnecessarily complicated. I would also separate y-axis' unit (s) and scale. $\endgroup$ – martin Jan 3 '14 at 13:41
11
$\begingroup$

There is a bit of an art to balancing aesthetic and informative aspects of a graphic. Prominent visualization consultant/authors like Edward Tufte and Stephen Few choose a minimal aesthetic that avoids distraction from the informative parts of the graph. However, for some audiences a small amount of flourish is justified -- see Alberto Cairo's journalistic application of data visualization, for instance.

The perceptual research angle is that every graphic element communicates a message, some that we aren't consciously aware of because our visual cortex deals with it ("pre-attentive processing"). Extra elements, even redundant ones, can result in extra processing. The appropriate graph depends on the message to be communicated and the audience.

To your specific question, a connected line emphasizes a trend (and variation from a trend). The filled area emphasizes deviation from the baseline. A bar chart or needle chart would emphasize discrete events deviating from a baseline.

The graphic's context is also important. If you have a grid of tightly packed graphs, the fill will help associate each line with its baseline.

Finally, another consideration for adding redundant graphic elements/florishes is that it makes it harder to extend the graph with more informative elements. For instance, you might want to highlight special values, overlay other trend lines or overlay bands, such as in the following mock-up.

enter image description here

$\endgroup$
  • 1
    $\begingroup$ I agree with this. Unless the graph needs be colorful because it's the front cover of a magazine/book (and the marketing people want it colored), color should be used to inform. If the graph looks "boring" then the culprit is the fact that the underlying information is not very interesting at all or not very interesting in line graph format. In such cases maybe it would be more useful in a pie chart, radar plot or something else. $\endgroup$ – rocinante Jan 4 '14 at 2:00
  • 1
    $\begingroup$ I suggest not using a pie chart. It's harder to perceive differences in arc length and wedge area than differences in height. If you don't believe me, compare a pie chart in ratios 32:34:33 to the same bar chart. Which one is easier to read? $\endgroup$ – shadowtalker Jan 4 '14 at 10:48
  • 2
    $\begingroup$ I was speaking in general terms, not specifically for the above graph. Each chart type has its merits. A certain chart type is not appropriate in all situations. $\endgroup$ – rocinante Jan 5 '14 at 19:53
4
$\begingroup$

A couple more points to consider:

As mentioned in a comment, an underfill is largely inappropriate if the x axis is not at a natural y zero point. This might be because the y axis is scaled to start at a number other than zero, or because the units used do not have a natural zero interpretation (e.g. Kelvin has a natural zero, while Celsius does not.)

Secondly, a case when an underfill is particularly valid is if the data themselves could be considered underfilled. For example, a line chart of the height of a mountain makes sense to be underfilled, the fill colour represents earth, while unfilled represents air.

A related example might be count data. If we stacked all the individuals at each x point, we would get a bar chart. If interpolating between the bars makes sense we would end up with a line chart with an underfill.

This image from the 'visual display of quantitative information' Might explain it a little better. It shows which military units were in Europe during the second war (I think). Stacking the units at each time point gives you an underfilled bar chart. Drawing a line over the top of the data gives you an underfilled line chart.

$\endgroup$
  • 2
    $\begingroup$ ... U.S. military units were in Europe during the First World War (the dates 1917 and 1918 tell the story). $\endgroup$ – Nick Cox Jan 11 '14 at 10:13
  • $\begingroup$ @nickCox Of course. No idea why I didn't see that. $\endgroup$ – timcdlucas Jan 13 '14 at 9:54
4
$\begingroup$

The previous two answers cover the main important points, but there are a few things that should still be mentioned.

First, I should say that I disagree with the extreme minimalist approach to graphing -- that all redundant ink must go. Distracting, non-meaningful variation should go. But a solid area versus a single line can catch the eye better and communicate more at a glance. And as you say, it can add "visual variety".

However, as @xan points out, that quick glance also interprets an area differently than a line, in ways partially subconscious.

An area graph implies a total quantity accumulating as you proceed along the x-axis. If you compare two graphs, and one has a larger area filled in, your glance will tell you that it has a greater total regardless of the start and end values.

In contrast, a line graph shows a changing value. The focus is on the change in position from one point to the next, not on the total accumulated.

So when should you use an area graph?

  • when the values represent a clear quantity with a definite zero point shown on the graph;
  • when the value represents an amount added (or removed) at each point, such as normal daily rainfall or monthly profit/loss;
  • when the value represents a distribution of a population, meaning that the total area under the curve represents the total size of the sample, such as bell curve of the number of students with different grades (basically a smoothed histogram).

The idea is that, when reading the graph, if you take two points on the x-axis, the area shown between them should represent an actual amount of something accumulating in that range. For this reason, if you values include negative amounts I'd recommend using opposite colours for negative and positive areas to emphasize that they cancel out in the total.

When should you not use an area graph?

  • when the zero point is arbitrary (as in non-absolute temperature, as @timcdlucas said), invalid (as in measurements that are a ratio of two values, like an exchange rate), or not shown on the graph for space reasons;
  • when the values shown by the height of the line already represent a cumulative measure, such as total rainfall to date (for the month/year) or debt/savings;
  • when the values represent the position/value of a single changing entity rather than an accumulation;
  • when you want to compare multiple lines on the same chart (if you can't see the whole area, you lose the meaning -- compare area charts side-by-side instead).

With those guidelines in mind, your ping graph can be interpreted two ways.

On the one hand, if you think of the ping speed as a as a single variable that changes over the course of the day, then a simple line chart would be most appropriate.

On the other hand, if you were comparing two different networks' daily ping-speed patterns (or the same network on different days / time periods), then maybe you want to emphasize the total amount of time required for network tasks. For example, if your graph had multiple peaks, instead of just one, a line graph would emphasize the variability in speed while an area graph would emphasize total delay.

Compare:
Line graph Same graph with filled area
The cumulative total is slightly greater in the first half of the graph (left of the red line) than the second, even if the peaks hit higher max values on the right. Filling in emphasizes that solid block on the left, so that it balances better against the peaks.

(Forgive the poor image quality -- couldn't figure out how to get R to do an area graph! Had to export and edit separately.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.