Best model for proactive agents? Explore our benchmark
Get started
← Back to all posts

Line graphs explained: when to use one, examples, and how to make one

By Srihari Thyagarajan•

Updated on October 22, 2026

Learn how to read line graphs, use trend lines, compare line and area charts, and create visualizations that show change over time.

Illustrative image for blog post

A line graph shows how a numerical value changes across an ordered sequence, usually time. Each point represents a measurement, and the lines connecting those points help us see trends, fluctuations, and changes in direction.

That makes line graphs useful for tracking anything from daily website traffic to annual revenue. A table can tell you that signups fell on Tuesday and recovered on Friday. A line graph makes the dip and recovery visible, along with whether either change fits a larger pattern.

The difficulty comes when the data gets less straightforward. A sudden spike might reflect a real event, a recurring seasonal pattern, or an error in the measurements. Adding more lines or smoothing them can help, but those choices can also hide important details.

We'll work through the main types of line graphs, how to read them, when area charts are useful, and how to create one using real datasets. Along the way, we'll use interactive Deepnote charts to examine real-world trends and see how different visualizations change what we can learn from the data.

What is a line graph?

A line graph, also called a line chart, plots numerical values against an ordered variable and connects the observations with lines. The horizontal axis usually represents time, while the vertical axis shows the measure being tracked.

Line graph key components & parts

A line graph contains:

  • X-axis: The ordered variable, such as dates, hours, or years.
  • Y-axis: The numerical measure, such as sales, response time, or temperature.
  • Data points: The observed values at particular positions.
  • Connecting lines: Segments that make changes between observations easier to follow.
  • Title and labels: Context about the metric, units, and period covered.

Consider monthly international airline passenger numbers from 1949 to 1960. The historical AirPassengers dataset records 144 monthly observations, measured in thousands of passengers.

The line generally rises over the 12 years, but it also moves up and down within individual years. Those repeated fluctuations are part of what makes the chart interesting. If we looked only at the first and last values, we would miss much of the pattern between them.

Line graphs work particularly well when the sequence matters. Months have a natural order, and connecting successive observations helps readers follow that order.

One detail is easy to overlook: a connecting line doesn't mean every intermediate value was measured. In a dataset with monthly observations, the segments show the progression between recorded months. They don't supply missing daily measurements.

Line graph use cases

Line graphs are most useful when the order of observations matters and readers need to follow changes between them.

Use case

Example question

Suitable approach

Track performance over time

How have weekly signups changed since launch?

A single line with consistent weekly intervals

Identify recurring patterns

Does passenger demand peak during the same months each year?

Monthly lines grouped by year

Compare groups over a shared period

How has revenue changed across three regions?

Multiple lines using the same dates, units, and scale

Investigate sudden changes

When did response times rise after a release?

The original observations with the release date annotated

Examine a longer-term trend

Is demand growing despite monthly fluctuations?

The original series alongside a clearly labeled moving average

Scan several metrics quickly

Which products show sustained growth or a recent decline?

Sparklines or small multiples with clear metric and period labels

Use a bar graph when individual category comparisons matter more than the sequence. If the question concerns the distribution of individual measurements, a histogram or box plot will show variation that a line of averages can hide.

Reading a line graph involves more than identifying whether the line goes up or down. We also need to consider the period, how frequently the data was collected, and whether the changes repeat.

Start with direction and scale

Begin with the axes. Check the units, the date range, and the intervals between observations.

An upward line indicates an increasing value across the displayed period. A downward line indicates a decrease. A relatively flat line suggests little change, although the scale can make modest changes appear much larger or smaller.

Look at the endpoints, but don't stop there. Two series can start and finish at similar values while following very different paths.

For example, monthly revenue might end the year close to where it began after several large fluctuations. That matters to a team managing cash flow, even if the annual change is negligible.

Look for seasonality

Seasonality means a pattern recurs at regular intervals, such as higher retail sales during certain months or heavier website traffic on weekdays.

The airline passenger chart provides a clear example. Passenger numbers tend to peak around the middle of each year and fall toward the end, even as the longer-term trend rises.

Placing the years on the same monthly scale makes the pattern easier to inspect. The chart helps us see that recurring peaks are part of the observed series, although it cannot establish what caused them.

For a business metric, the same approach can reveal whether a downturn is unusual or similar to what happened during the corresponding period last year.

Use trend lines to separate signal from noise

A trend line summarizes the broader movement in a series. It can help readers distinguish sustained change from shorter-term fluctuations, but it does not establish which observations are noise. Seasonal peaks and sudden changes may contain useful information.

Here, we use a trailing 12-month moving average. Each point averages the current month and the preceding 11 months, giving us a full year of observations in each calculation. The first 11 months have no moving-average value because a complete window is not yet available.

The moving average makes the longer-term rise easier to follow while reducing the seasonal peaks visible in the original series. Because it looks backward, it also responds more slowly to recent changes.

Keep the monthly observations visible alongside the summary. Choose the window to match the question: a seven-day average can help summarize daily traffic, while a 12-month average can reduce seasonal variation in monthly data. A moving average changes the calculation; simply drawing curved connectors between points does not.

Types of line graphs

Most line graphs use the same basic structure. The variations concern how many series appear and how much detail the chart is intended to show.

Simple line graph

A simple line graph tracks one measure over an ordered sequence.

It is useful when readers need to concentrate on a single metric, such as weekly active users, monthly expenses, or daily API latency.

The airline passenger chart above is a simple line graph. There is one measure, one time axis, and one connected series.

Multiple line graph

A multiple line graph shows two or more series on the same axes, allowing us to compare their movements across a common period.

For example, the Gapminder dataset contains historical life expectancy estimates for different countries. We can plot India, China, Japan, and the United States on one chart.

All four series use the same years and the same vertical scale. This lets us compare both the values and how they changed over time.

The data was recorded at five-year intervals in this extract, so each line connects observations from successive five-year periods.

Multiple lines are useful for comparing regions, products, or experiment groups. However, adding too many series makes it difficult to follow individual paths. When the chart becomes crowded, consider showing fewer series or splitting them into smaller charts.

Sparklines

A sparkline is a compact line graph that summarizes a series with little visual detail, often beside a number or inside a table.

The example below uses historical life expectancy for India, China, Japan, and the United States. Each country has its own compact line covering 1952–2007. All four use the same vertical range, so differences in height remain comparable.

These charts hide conventional axes and tick labels to make the overall paths easier to scan. Hover details provide individual values, but the larger line charts are better for examining dates and differences precisely.

A dashboard can use the same compact format beside a KPI, such as a revenue figure accompanied by its recent history. The metric, reporting period, and scale still need enough context for readers to interpret the pattern.

Area charts vs. line graphs

A line graph emphasizes the path between observations. An area chart fills the space between that line and a baseline, giving more visual weight to the amount represented.

Question

Better starting point

Why

When did a measure rise, fall, or change direction?

Line graph

The line keeps attention on the trajectory

How do several series change independently?

Multiple lines or small multiples

Each series can be followed without overlapping filled regions

How large is a nonnegative quantity over time?

Simple area chart

The fill emphasizes magnitude against a zero baseline

How do components contribute to a changing total?

Stacked area chart

The complete stack shows the total and its layers show contributions

How does the composition change proportionally?

100% stacked area chart

Each layer shows its share, although the overall total is hidden

An area chart does not automatically show a cumulative measure. Its values are cumulative only if the underlying calculation makes them so. Use a zero baseline when the filled area represents magnitude.

Simple area charts

A simple area chart displays one numerical series with the space beneath its line filled.

It works well for a nonnegative measure when you want to emphasize its magnitude over time. Examples include cumulative spending or the number of active subscriptions.

For example, this area chart uses Gapminder population estimates for India from 1952 to 2007. The filled region emphasizes how the population increased over the observed period.

The filled area adds visual weight, though it may not provide much additional information compared with the original line.

If the main question is about precise changes in direction, a regular line graph is often clearer.

Stacked area charts

A stacked area chart combines multiple series into colored layers. The height of the complete stack represents their combined total at each point.

To demonstrate this, we used Gapminder population data for India, China, Japan, and the United States from 1952 to 2007.

Each layer contributes to the combined population represented by the chart.

This layout can be useful when the question concerns both total growth and how different components contribute to it. A business equivalent might show subscription revenue by product over several years.

There is an important limitation. Only the bottom layer has a consistent baseline. The remaining layers sit on top of changing values, making it difficult to judge their individual trends precisely.

If the goal is to compare each component's growth, separate lines are often easier to read.

100% stacked area charts

A 100% stacked area chart normalizes the total to 100% at every point. Each layer shows its proportion of the combined total.

Using the same four-country dataset, we can see how each country's share changes within the selected group.

This is a composition chart, so the total stays at 100% throughout. That makes relative shares easier to inspect, but it conceals changes in the overall population.

A country could gain population while its percentage share declines because the other countries grow faster.

In product analytics, a subscription plan can account for a smaller share of the company’s subscribers even while its own subscriber count increases.

For that reason, we should avoid treating a falling percentage as proof that the underlying quantity is shrinking.

Use stacked area charts when composition over time is the central question. When readers need to compare exact values or understand how each series behaves independently, ordinary line graphs offer a clearer view.

Line graph vs. scatter plot vs. bar graph

These three charts can represent related data, but each answers a different question.

Chart

Best suited to

Example

Line graph

Change along an ordered sequence

Monthly customer growth

Scatter plot

Relationships between two numerical variables

Revenue versus marketing spend

Bar graph

Comparisons across categories

Revenue by sales region

A line graph connects successive observations because their order is meaningful. A scatter plot positions individual observations using two numerical axes and generally leaves them unconnected.

For example, we can use Gapminder data to compare life expectancy with GDP per person for four countries in 2007.

Each point represents one country, with GDP per person on the horizontal axis and life expectancy on the vertical axis. A scatter plot is appropriate because we're examining the relationship between the two measurements.

Connecting these countries with lines would suggest an order or path that doesn't exist in the data.

If you want to examine how numerical variables relate to each other, try the scatter plot maker.

A bar graph, meanwhile, is more appropriate when the categories themselves are the focus. Comparing total revenue across four departments is a straightforward bar chart problem. You can use the bar graph maker for that comparison.

Time alone doesn't determine the chart type. Comparing sales totals across three selected years may work well with bars. Tracking monthly sales across five years generally benefits from a line.

Line graph examples with real data

The following examples show why line graphs are useful beyond the standard sales-over-time scenario.

Example 1: Seasonal passenger demand

The AirPassengers dataset records monthly international airline passenger numbers from January 1949 to December 1960.

In January 1949, the series reports 112,000 passengers. In July 1960, the monthly figure reaches 622,000.

The overall rise is visible, as are repeated seasonal peaks and troughs.

This is the kind of pattern an analyst might investigate in subscription usage, consumer demand, or support ticket volume. A summary of annual totals would capture the growth, but it would hide much of the variation within each year.

Example 2: Life expectancy across countries

The Gapminder dataset includes historical estimates of life expectancy at birth, population, and GDP per person.

We selected four countries and plotted their life expectancy figures from 1952 to 2007.

The lines show improvements over the period, although their starting points, trajectories, and fluctuations differ.

In 2007, the dataset reports life expectancy of approximately 82.6 years for Japan, 78.2 for the United States, 73.0 for China, and 64.7 for India.

The value of the chart lies in the paths between the endpoints. We can see when gaps widened or narrowed and whether the countries followed similar trajectories.

These are historical estimates from a particular dataset extract. They should not be presented as current life expectancy figures.

Example 3: Population growth and changing composition

Our third example uses Gapminder population estimates for India, China, Japan, and the United States from 1952 to 2007.

The chart on the left shows how the countries' combined population increased, while the one on the right shows how each country's share of that total changed.

A country's population can increase even as its share of the combined total declines, particularly when other countries grow faster.

The same pattern can appear in business metrics. A product might gain customers while accounting for a smaller percentage of the overall customer base. Looking at both absolute counts and relative shares gives us a clearer picture of what's happening.

How to make a line graph

The basic process is to arrange a series of values in the correct order, select the measure you want to track, and choose a chart that makes changes easy to read.

Make a line graph with Deepnote Agent

Deepnote’s line graph maker lets you describe the data preparation and visualization together. The request can include values directly or name a dataset Agent can load through a Python library.

For this example, ask Agent to load the historical airline-passenger series through Seaborn and plot the monthly observations alongside a moving average:

Load the airline-passenger dataset using seaborn.load_dataset("flights"). Build a monthly date column from year and month, sort it chronologically, and check for missing months, duplicate months, and missing passenger values.

Create an interactive line graph covering January 1949 through December 1960. The passenger values are in thousands. Plot the original monthly observations with straight connectors, then add a trailing 12-month moving average using only complete windows. Leave the first 11 moving-average values unavailable.

Use a thin blue line for “Monthly observations” and a thicker orange line for “Trailing 12-month average.” Keep both on one vertical axis labeled “Passengers (thousands),” ranging from 0 to 700. Label the horizontal axis “Month” and title the chart “Monthly airline passengers and 12-month average, 1949–1960.”

Verify that the dataset contains 144 monthly observations, beginning with 112 in January 1949 and ending with 432 in December 1960. Show a table containing the dates, original values, and calculated averages. Identify the data as historical observations and the moving average as a backward-looking summary, not a forecast.

Deepnote-Agent-line-graph-response.png

The date and row-count checks help confirm that the moving-average windows represent consecutive months. Keeping both lines visible lets readers compare the broader rise with the seasonal fluctuations that the average reduces.

A follow-up request can examine those fluctuations more directly:

Create a separate seasonal comparison for 1958, 1959, and 1960. Put January through December on the horizontal axis and use one line per year on a shared passenger scale. Keep the original monthly values and label the units as thousands of passengers.

The notebook keeps the loading, date preparation, and calculations alongside the charts, so the team can inspect and revise the analysis.

Make a line graph in Excel

Deepnote offers a more direct workflow for these tasks: Agent can load the dataset, prepare dates, calculate a moving average, and build the chart from one request. If your analysis is already organized in an Excel workbook, you can also create the chart there.

Place dates in one column and the numerical values in another. Select the table, open the Insert tab, and choose a line chart. For several series, put each measure in a separate column with dates shared across the rows.

Check that Excel recognizes the dates and maps each series correctly, then adjust the axes, labels, line styles, and legend. Our guide to making a line graph in Excel covers date spacing, multiple series, moving averages, and secondary axes.

Common line graph mistakes

Using too many lines

With a few series, readers can follow each trend. With dozens, overlapping lines and a large legend make individual movements hard to distinguish.

Show the most relevant series, use small multiples, or provide an interactive filter if readers need to explore a larger set.

Adding a second y-axis without enough context

Dual-axis charts place two measures on separate vertical scales. That can make unrelated series appear to move together, depending on how the axes are configured.

Before adding a secondary axis, consider whether separate charts would communicate the relationship more clearly.

If two measures share compatible units, a single scale is usually easier to interpret.

Choosing a misleading baseline

Unlike bar graphs, line graphs don't always need a zero baseline. When the purpose is to inspect small fluctuations, a narrower vertical range may make meaningful changes easier to see.

However, a narrow range can also exaggerate the visual impression of a change.

Always label the scale clearly, consider the magnitude of the difference, and make sure the chosen range supports the question being asked.

Connecting missing observations

A gap in a time series may represent missing data, a system outage, or a period without observations.

Connecting the points on either side can make the measurements appear continuous. Filling missing values with zero creates a different problem by implying that the measured quantity fell to zero.

Decide whether gaps should remain visible or whether a documented interpolation method is appropriate. Do not silently replace missing observations.

Smoothing away important changes

Smoothed curves may make charts look cleaner, but aggressive smoothing can conceal sharp changes or suggest values that weren't observed.

Use straight segments when the exact recorded points matter. If you add a moving average or another smoothing method, identify it and retain access to the original series.

Comparing incompatible time intervals

A series of daily observations and a series of monthly totals cannot be compared directly without addressing the difference in measurement frequency.

Aggregate or align the values to a common interval first. Also check that dates represent the same time zones and reporting periods.

Create a line graph from your data

Before making a line graph, decide what you want readers to notice. Are you tracking sustained growth, investigating an unusual spike, comparing several series, or looking for a recurring seasonal pattern?

Those questions determine which values to plot, how much history to include, and whether a simple line or an area chart is appropriate.

With Deepnote’s AI chart generator, you can provide the values or name a dataset to load, describe the comparison, and refine the visualization through follow-up requests.

If your data calls for a different visualization, our guide to the 31 types of graphs and charts explains when to use each.

Frequently asked questions

01

What is a line graph used for?


02

How do you read a line graph?


03

What are the different types of line graphs?


04

What is the difference between a line graph and a scatter plot?


05

When should you use an area chart instead of a line graph?


06

Can a line graph have more than one line?


07

Does a line graph have to start at zero?


08

How can I make a line graph without coding?


Srihari Thyagarajan

Technical Writer

Follow Srihari on Twitter, LinkedIn and GitHub

Blog

Illustrative image for blog post

Meet agentic apps: use and sync them in Codex, Claude, and everywhere else

By Jakub Jurovych

•

Updated on November 19, 2026

Try Deepnote now

Get started – it’s free
Book a demo

Footer

Solutions

  • Python notebook
  • SQL notebook
  • R notebook
  • Data apps
  • Machine learning
  • Data teams

Product

Company

Comparisons

Resources

Tools

Footer

  • Privacy
  • Terms

© 2026 Deepnote. All rights reserved.