Line Charts — Data Visualization

A line chart joins one point per moment in time from left to right, and is read by its slope. Time is in order and every step is the same: a missing month…

A line chart draws one point for each moment in time and joins the points from left to right. Your eyes read the slope of the line: rising, falling or flat. That is why a line chart answers questions about change over time.

Time along the horizontal axis, in order and evenly spaced

The horizontal axis of a line chart is time, the earliest on the left. Every step along that axis must cover the same length of time: one day, one week or one month. If a month is missing from the data, the line joins the months before and after it as if they were neighbours, and a change over two months looks like one step.

Owen's question: did the weather get hotter from January to June? This is the mean of the daily highest temperature in each week, Monday to Sunday:

(chart picture)

The line rises from left to right: the January mean is 30.0 °C, the June mean 32.2 °C, about two degrees hotter. The coolest week was 29.1 °C (the week from 12 Jan), the hottest 32.8 °C (the week from 18 May).

A line's axis may start near its values

Look at the vertical axis: it starts at 29, not at zero. On a bar chart that misleads, because your eyes compare the lengths of the bars. A line chart has no bars. What you read is the slope and the ups and downs, so its axis may start near the lowest value. This is the same line with its axis from zero:

(chart picture)

The rise of about two degrees almost disappears, yet at this shop, hotter days usually have a larger share of iced drinks. Two conditions: the numbers on the axis must show, and the title must not exaggerate. A narrow axis makes small ups and downs look large, so read first where the axis starts and ends.

Daily or weekly

The closer the points, the more small ups and downs get drawn too. These are the orders per day over 84 days:

(chart picture)

The line jumps from 12 orders (6 Apr) to 52 (11 May), and goes up or down almost every day. The direction over three months is lost in the zigzag. Add the days up per week, and the direction appears:

(chart picture)

The April weeks hold 112 to 156 orders, the June weeks 157 to 181. There is one peak: the week from 11 May, with 220 orders. That is the week the shop sent a 20% discount message to app members who had not ordered in the past month, which the lesson A/B Testing covers.

Pick the time step that answers the question. A question about one day needs daily points. A question about the direction over many weeks is clearer per week or per month.

Several lines

One line chart can hold several series, one line for each. These are the same weekly orders, split by channel:

(chart picture)

Each series has its name at the end of its line, so you do not have to look back and forth at a legend. In store rose from 84 orders in the first week to 142 in the week from 15 Jun. Delivery jumped from 52 to 107 in the week of 11 May, then fell back to 45. So the peak on the total line came almost entirely from delivery.

Three or four lines still read well. Beyond that, the lines cross each other like spaghetti, and none can be followed. For 16 items, pick the few that matter, or make several small charts.

Do not join categories

A line means there is an order, and something between two points: between 6 April and 7 April, time passes. Between Black Coffee and Milk Coffee there is nothing. Menu items, channels or payment methods are drawn as bars, not as a line.

⚠️ Common mistakes

TL;DR: A line chart joins one point per moment in time from left to right, and is read by its slope. Time is in order and every step is the same: a missing month makes two months look like neighbours. Its axis may start near its values, because no bars are compared by length: Leafy Corner's weekly temperature rose from about 30 to 32 °C, and from zero that rise almost disappears. Daily points hold many small ups and downs (12 to 52 orders a day), weekly points show the direction. Three or four lines still read well, with their names at the ends, and a line is not used for categories such as menu items.

⚡ An axis from zero?

Guess first: Leafy Corner's mean highest temperature per week lies between 29.1 and 32.8 °C. On its line chart, must the vertical axis start at zero?

It does not have to. A line chart is read by its slope, not by the length of bars. From zero, the rise of about two degrees becomes an almost flat line.

Meaning: A line chart's axis may start near its values, as long as the numbers on the axis show and get read.

⚡ Daily or weekly

Guess first: Hannah wants to know whether orders grew from April to June. Which answers faster: a line of orders per day or per week?

Per week. The daily line jumps from 12 to 52 orders, so the direction is lost. The weekly line shows 112 to 156 orders a week in April and 157 to 181 in June.

Meaning: Pick the time step that answers the question. The direction over many weeks is clearer per week.

⚡ Many lines

Guess first: Owen draws the weekly servings of all 16 items as 16 lines on one chart. What is the problem?

The lines cross each other and there are too many colours, so no item can be followed. Pick three or four items that matter, or make several small charts.

Meaning: One line chart holds three or four lines at most, each with its name at its end.

⚡ A line or bars

Guess first: Hannah wants to compare the servings sold of each item. A line chart that joins the items, or a bar chart?

A bar chart. A line suggests an order and something between two points, yet between Black Coffee and Milk Coffee there is nothing.

Meaning: A line chart is for time in order. Categories with no order, such as menu items, are drawn as bars.

What you will learn