Matplotlib: Subplots, Labels, Legends, Saving

Several charts on one page — and a file you can put in a report

35 min · interactive lesson with runnable code and 4 graded exercises.

What you'll be able to do

  • Build grids with plt.subplots and loop over axes.ravel()
  • Decide when to share axes
  • Label, title (panel vs figure) and place legends so nothing is clipped
  • Save figures with the right format, dpi and bbox_inches

The full lesson is free with an account.

plt.subplots

Shared axes

Labels, titles, limits

Legends

tight_layout and savefig

Pitfalls