The Line Chart

What is a Line Chart?

One of the simplest chart types, a line chart is a visual representation of individual data points that are plotted and connected by a line. The structure of the chart consists of a horizontal x-axis and a vertical y-axis, typically intersecting at the bottom of the y-axis and the left end of the x-axis. Line charts are mainly used with positive values, so the intersection of the axes is the point (0, 0). This creates a coordinate plane on which each data point is plotted.

Each axis is labeled with a data type; the x-axis is commonly used to display measures of time, and the y-axis displays quantitative values. Data are plotted using x and y coordinates and then connected with a line in a “dot-to-dot” method. More than one line can be plotted in the same plane as a form of comparison and should be differentiated by color or line type, indicated by a chart legend.

When to Use a Line Chart

A line chart is used to depict changes in data, therefore should be used when data are ordered chronologically or sequentially. Line charts show the local change from point to point, as well as the overall trend for the data points making them useful in many aspects of data analyzation.

When creating a line chart, the categories used for the x and y axes should have a proposed relationship. The shape and slope of the resulting line provides insight about the relationship between the categories which is ultimately the goal of this visualization. With the ability to have multiple lines in one chart, line charts should also be used when wanting to compare trends between a few different variables.

Let’s take a look at an example where the line chart is a great choice of visualization:

 

Chart made using Chartio

In this example, we’re interested in looking at a business’s revenue per quarter for the years 2012 and 2013. The line represents the overall trend of revenue per quarter with each dot representing the dollar amount for the quarter, the x-axis represents the four quarters of 2012 and 2013, and the y-axis is the scale for the revenue in dollars.

From the line chart, it’s easy to see that revenue per month has steadily increased from the first quarter of 2012 to the second quarter of 2013, but has made a slight decrease in the third and fourth quarters of 2013. The line chart can be used to visualize this data because it has a chronological order to it.

When NOT to Use a Line Chart

Determining when to use a line chart is usually simple, but there are some areas where a line chart is not the ideal visualization choice. First, the line chart shouldn’t be used when the data you want to visualize is not continuous and doesn’t have an order. Non-continuity and random order create a messy plot of data points that can’t easily (or at all) be connected by a line.

Second, line charts shouldn’t be used to compare a large number of data points or a large number of categories. Too many data points will overcrowd the line and make interpretation of the difference between individual points very difficult. Too many categories overcrowds the visualization with multiple lines, making the comparison between each category difficult. While “too many” depends on a number of different factors specific to your data and visualization, a good baseline to follow is no more than fifty data points or five lines should be included in a single line chart.

Let’s look at an example where the line chart is NOT a great choice of visualization:

Chart made using Chartio

In this example, we’re interested in looking at a business’s customer payment trend over time. The x-axis represents the year 2018 by day from March through November, the y-axis is the scale for the amount of payment, and the line represents the total count, or number, of payments made each day.

So why is a line chart a poor choice of visualization for this data? Well, it’s obvious that the day-to-day payment trend is hard to detect due to the closeness and sporadic placement of data points across the x-axis; the chart is simply too overcrowded by the number of data points. From this line chart, we can see the overall trend of the count of payments has increased from March to November, but it’s difficult to see the individual increases and decreases between each day and detect the important values in this chart. A line chart could be a good visualization for this data if it used a different time scale, like count of payments per month instead of day.  

Comparison of Comparison Chart Types

Simply put, the line chart is a data visualization that’s used to show comparisons between multiple values. Other types of visualizations that compare multiple values are the bar chart and the bar line chart. The table below gives the use case and pros and cons of the line, bar, and bar line charts:

Line Chart

Bar Chart

Bar Line Chart

Use

  • Visualize continuous data, often changes over time
  • Visualize discontinuous (or discrete) data or to show the relationship between a part to a whole
  • Visualize a data set with both a continuous and a categorical metric

Pros

  • Ability to show individual data points and multiple datasets
  • Can easily show trends over time
  • Clear comparison of different categories on a labeled scale
  • Two axes allow for comparisons with different measurement scales

Cons

  • Data must have an order to make a structured line
  • The order of the bars can impact interpretation
  • Can become cluttered easily
  • Can be complex and complicate analysis

References

About Bryn Burns

Hi! I'm Bryn Burns. I am a current senior at Virginia Tech pursuing degrees in Statistics and Mathematics. Data science and visualization are two things I'm very passionate about, as well as working with numbers and helping people learn. I'm thrilled to share my knowledge here at The Data School!