Plotting with Matplotlib

18 min read

Numbers in a table are hard to judge. A picture shows you the story in a second. You can see a loss that stopped falling, or one request that took ten times longer than the rest. Matplotlib is the standard Python library for drawing charts. In this lesson you will make line, scatter, bar and histogram charts from AI data. You will also learn how to pick the right chart.

New words

Plot
A chart drawn from your data.
Figure
The whole sheet of paper that charts are drawn on.
Axes
One chart on the figure, with an x axis and a y axis.
Axis label
The text that tells what an axis shows, with its unit.
Legend
A small key that tells which line is which.
Histogram
A chart that shows how many values fall in each range.
Outlier
A value far away from all the others.

What you will learn

  1. Why plot before you model
  2. Your first chart: a line plot
  3. Figure and axes, with titles and labels
  4. Several lines and a legend
  5. Scatter and bar charts
  6. Histograms: how values are spread
  7. Subplots: charts side by side
  8. Try it: which chart fits the question?
  9. Common mistakes
  10. Explain it to a friend
  11. Key takeaways

10 quiz questions at the end.

Start this lesson

The full lesson, with interactive demos and the quiz, opens after you sign in with Google. It is free.

All lessons · Back to the roadmap