Module 4 · Beginner · Functions and graphs

How to read any graph

How to read graphs step by step: axes, units and scales, trends, steepness, reading values, the vertical line test, and spotting misleading charts.

By theprogrammers team · · 7 min read

You'll see thousands of graphs as a data scientist: in reports, dashboards, research papers, and in the output of your own code. Most people glance at a graph and take away a vague impression: "it goes up". A trained reader takes away much more: how fast it goes up, when it changed, what value it had at a given point, and whether the chart is being honest.

Reading graphs is a skill, and like any skill, it follows a routine. This lesson teaches that routine step by step, using a real-looking example: a phone's battery over a day. It covers axes and scales, reading values off a line, what steepness means, how to spot a function from its graph, and the tricks that make charts misleading.

What you need first: coordinates and the Cartesian plane and what is a function?.

Key terms

  • Axis label: the text saying what an axis measures, and in what units.
  • Scale: how far apart the numbers on an axis are.
  • Trend: the general direction of the data: rising, falling or flat.
  • Rate of change: how fast the output changes as the input changes; on a graph, the steepness.
  • Interpolation: estimating a value between known points.
  • Extrapolation: estimating a value beyond the known points (riskier).

Step 1: read the title and the axes

Before looking at the line, read:

  1. The title: what is this graph about?
  2. The x-axis: what's along the bottom, and in what units? Usually the input, often time.
  3. The y-axis: what's up the side, and in what units? Usually the output.
  4. The scales: does the y-axis start at zero? Are the steps even?

Here's a phone's battery level through an afternoon:

import numpy as np
import matplotlib.pyplot as plt

hours = np.array([0, 1, 2, 3, 4, 5, 6, 7])
battery = np.array([100, 88, 75, 70, 70, 55, 30, 10])

fig, ax = plt.subplots()
ax.plot(hours, battery, "o-", lw=2)
ax.annotate("flat: phone switched off", (3.5, 70), xytext=(3.6, 85),
            arrowprops={"arrowstyle": "->"})
ax.annotate("steepest: video call", (5.5, 42), xytext=(1.0, 25),
            arrowprops={"arrowstyle": "->"})
ax.set_xlabel("Hours after 12 noon")
ax.set_ylabel("Battery level (%)")
ax.set_ylim(0, 105)
ax.set_title("Phone battery through the afternoon")
ax.grid(alpha=0.3)
plt.show()
A line chart of battery level in percent against hours after noon, from 0 to 7. The line falls from 100 to 70 by hour 3, stays flat at 70 between hours 3 and 4 (annotated "flat: phone switched off"), then falls steeply to 10 by hour 7, with the steepest part annotated "steepest: video call".

Title: battery through the afternoon. x-axis: hours after noon. y-axis: battery percentage, starting at 0. Now you know what you're looking at.

Step 2: describe the overall trend

Ignore the details and describe the shape in one sentence: "The battery falls from 100% to 10% over seven hours." That's the headline.

Step 3: look at steepness

The steepness of a line tells you how fast the output is changing:

  • Steep line: fast change.
  • Gentle line: slow change.
  • Flat line: no change at all.
  • Going up (left to right): increasing. Going down: decreasing.

On the battery graph:

  • Hours 0 to 3: a steady fall of about 10% an hour.
  • Hours 3 to 4: flat. Nothing was using the battery; the phone was off.
  • Hours 5 to 6: the steepest part, 25% in one hour. Something power-hungry was running.

Steepness has a precise name, slope, and a formula, covered in slope and intercept. It's the most important idea in this whole module, because in calculus it becomes the derivative, and in machine learning, the gradient that models follow to learn.

Step 4: read values off the graph

Reading a y-value: to find the battery at hour 6, go up from 6 on the x-axis to the line, then across to the y-axis: 30%.

Reading an x-value: when did the battery hit 55%? Go across from 55 on the y-axis to the line, then down: hour 5.

Between points: the battery at 2.5 hours wasn't measured, but the line between hours 2 (75%) and 3 (70%) suggests about 72.5%. Estimating between known points is called interpolation. NumPy can do it:

print(np.interp(2.5, hours, battery))
print(np.interp(5.5, hours, battery))
72.5
42.5

Beyond the points: when will the battery die? It's falling about 20% an hour at the end, so maybe around 7.5 hours. Guessing beyond your data is extrapolation, and it's risky: the user might plug the phone in. Models have the same problem: they're much less reliable outside the range of data they learnt from.

Step 5: is it a function? The vertical line test

A graph shows a function if every input has only one output. Visually: any vertical line crosses the graph at most once.

  • The battery graph passes: at any moment, the battery has one level.
  • A circle fails: a vertical line through its middle hits it twice.
  • A sideways parabola, like x = y², fails for the same reason.

Step 6: check whether the chart is honest

Charts can mislead without lying about a single number. The most common trick is a truncated y-axis: starting it just below the data instead of at zero.

months = ["Jan", "Feb", "Mar", "Apr"]
sales = [102, 104, 103, 107]

fig, (left, right) = plt.subplots(1, 2, figsize=(9, 3.5))
left.bar(months, sales, color="tab:red")
left.set_ylim(100, 108)
left.set_title("Axis starts at 100: looks dramatic")
right.bar(months, sales, color="tab:blue")
right.set_ylim(0, 120)
right.set_title("Axis starts at 0: a small change")
for ax in (left, right):
    ax.set_ylabel("Sales (units)")
plt.tight_layout()
plt.show()
The same four monthly sales values, 102, 104, 103 and 107, shown twice as bar charts. On the left, the y-axis runs from 100 to 108, so April's bar looks several times taller than January's. On the right, the axis starts at 0 and all four bars look almost the same height.

The data is identical: sales rose about 5%. The left chart makes it look like they multiplied. For bar charts, the axis should start at zero, because the bar's length is the message. Line charts can zoom in, as long as the axis is clearly labelled.

Other things to check:

  • Uneven scales: gaps between years that aren't equal.
  • Missing units: "growth of 40": 40 what?
  • Two y-axes: lines on different scales can be made to look related.
  • Log scales: each step multiplies instead of adding. Useful, but easily misread; see why data scientists use log scales.

The chart design module of the charts course goes deeper into honest charts.

A reading checklist

  1. Title: what's this about?
  2. Axes: what's measured, in what units, from what starting point?
  3. Trend: what's the one-sentence summary?
  4. Steepness: where does it change fastest, slowest, or not at all?
  5. Values: what do key points read?
  6. Honesty: is the axis truncated, the scale uneven, or anything missing?

Practice

Use the battery graph.

  1. What was the battery at hour 1?
Show the answer

88%.

  1. During which hour did the battery fall the most?
Show the answer

Hours 5 to 6: from 55% to 30%, a fall of 25%.

  1. Estimate the battery at 6.5 hours.
Show the answer

Halfway between 30% and 10%: about 20%. np.interp(6.5, hours, battery) gives 20.0.

  1. A chart shows a bar for 2024 at 98 and 2025 at 100, with the y-axis starting at 97. The 2025 bar looks 3 times taller. What's the real change?
Show the answer

About 2% (from 98 to 100). The truncated axis exaggerates it.

  1. Does a horizontal straight line pass the vertical line test? Does a vertical one?
Show the answer

A horizontal line passes (every x has one y), so it's a function. A vertical line fails: one x has infinitely many y values.

Key takeaways

  • Read the title, axes, units and scales before the data.
  • Summarise the overall trend in one sentence.
  • Steepness is rate of change: steep is fast, flat is no change.
  • Interpolating between points is reasonable; extrapolating beyond them is risky.
  • A graph is a function if any vertical line crosses it at most once.
  • Bar charts should start at zero; check for truncated or uneven axes.

Frequently asked questions

What does the steepness of a graph mean?

It shows how fast the output changes as the input changes. A steep line means a fast change, a gentle line a slow change, and a flat line no change.

What is the difference between interpolation and extrapolation?

Interpolation estimates values between known data points; extrapolation estimates values beyond them. Extrapolation is less reliable because the pattern may not continue.

What is the vertical line test?

A way to check whether a graph shows a function: if any vertical line crosses the graph more than once, one input has several outputs, so it's not a function.

What to learn next

  1. Measure steepness exactly in slope and intercept of a straight line.
  2. Revisit coordinates and the Cartesian plane.