Skip to the workspace
Pebellslearn by building
Statistics  ›  Lesson

Graphs and Charts

Graphs & Charts 12 minThe right chart follows from the question: how many variables it involves, whether each is a number, a category or time, and what comparison matters.

machine learning / Graphs and Charts

Explore each scene at your own pace.

01 · The rule

The rule

Graphs and Charts

A table of 200 rents tells you almost nothing at a glance. The right chart shows the pattern in two seconds: a long tail, an outlier, a trend. The wrong chart hides it or, worse, invents a pattern that is not there. Choosing well is a small, repeatable decision.

The rule

Pick the chart from the question: one variable, two variables, groups, or time.

Each common chart answers one kind of question:

  • Histogram: how is one numeric variable spread? Bars count how many rents fall in each band (10–15, 15–20, and so on). It shows the shape: symmetric, skewed, two humps.
  • Box plot: a compact view of one numeric variable. The box runs from the first to the third quartile, a line marks the median, and dots beyond the whiskers flag outliers like the penthouse at 80. Several box plots side by side compare groups.
  • Bar chart: one number per category, such as the average rent for 1-, 2- and 3-room flats.
  • Scatter plot: two numeric variables, one dot per item. Size against rent for our five flats shows whether bigger flats cost more.
  • Line chart: a number over time, such as average rent each month.
import matplotlib.pyplot as plt
sizes = [40, 60, 80, 50, 70]
rents = [14, 22, 26, 16, 22]
plt.scatter(sizes, rents)
plt.xlabel("Size (m²)")
plt.ylabel("Rent (₹ thousand per month)")
plt.show()

Honesty rules that apply to every chart:

  • Label both axes, with units.
  • Start bar charts at zero. A bar's length is the message; cutting the axis at 18 makes 20 look twice as big as 19.
  • Avoid pie charts with many slices; people compare lengths far better than angles.
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.