When a line chart is the right choice, when another chart reads better, and how to draw one that tells the truth. The same rules hold in every chart library. For picking between chart types in general, see Choosing a chart.
What it is for
A line chart shows how a value changes across an ordered range, most often time. Each point is a measurement, and the line between points shows the direction and speed of the change.
When to use
The reader asks whether something goes up or down, and how fast, such as revenue per month.
There are many points in time, from a dozen to thousands.
You compare the trends of two to five series on the same scale, such as desktop and mobile visitors.
The values do not start near zero and small changes matter, such as a stock price or a response time.
Use something else when
The categories have no order, such as products or countries. Use a bar chart: a line between unordered categories suggests a trend that does not exist.
There are only a few points and the reader compares their sizes. Use a bar chart.
The series are parts of a total and the total matters. Use a stacked area chart.
You show the relation between two measures, not a change over time. Use a scatter plot.
You compare only a start and an end value for each item. Use a slopegraph or a dumbbell chart.
There are more than about five series. Highlight one and gray the rest, or use small multiples, one small chart per series.
How it reads
A line encodes the value as position on a common scale, which people read most accurately. The slope of each segment shows the rate of change, so the reader sees rises, falls and turning points at a glance. Because the eye reads slope, the shape of the line depends on the chart's aspect ratio and on the range of the value axis.
Do it well
Pick a value range that fits the data. A line does not need zero, but say so when the axis starts above it.
Space time by elapsed time. Use a time scale for dates, so a missing week leaves a gap of the right width.
Name each line at its end instead of in a legend when there are a few, so no one matches colors.
Give each series a second signal besides color: a dash pattern, a marker shape or a direct label.
Show markers on the points when there are few of them, or when the reader needs to see where each measurement is.
Break the line where data is missing. The Missing data guideline explains why.
Pitfalls
Too many lines in one chart. They tangle into noise. Highlight the one that matters and gray the rest.
Smooth curves that overshoot. Some curves bend past the real high or low between two points. Use a monotone curve, or straight segments.
Two value axes, one per line. The crossing points depend on how you scale each axis, not on the data. Index both series to a start value instead.
Connecting across missing data. The line invents values that were never measured.
A chart so wide and flat, or so narrow and tall, that every change looks flat or steep.
Variants
Single: one series over time.
Multiple: two to five series on the same scale.
Step: a value that holds until the next point, such as a price.
Indexed: each series as a change from its first value, to compare series of different sizes.
Slopegraph: two points per series, to compare a before and an after.
Bump chart: the rank of each series over time.
Sparkline: a small line without axes, next to a number.
Compared with similar charts
Against a bar chart: lines show the trend between values, bars compare separate values. With fewer than about six periods, bars read better.
Against an area chart: an area adds weight to one amount or a stack of parts. Lines keep several series readable when they cross.
Against a scatter plot: a scatter plot shows how two measures relate. A line chart shows one measure along an ordered range.