Part III: matplotlib

This is where you start writing code. After nine chapters of perception science and design thinking, Part III puts a plotting library in your hands and asks you to build something.

matplotlib is the foundational visualization library in the Python ecosystem. Nearly every other Python plotting library, seaborn included, is built on top of it. Understanding matplotlib deeply is not optional if you want full control over your output. It is also the library most likely to frustrate you, because its API carries decades of history and its defaults are famously ugly out of the box. Part III addresses both of those realities. You will learn the architecture that makes everything click into place, and you will learn the customization techniques that turn matplotlib's plain defaults into publication-quality figures.

The six chapters progress from architecture to mastery:

  • Chapter 10: matplotlib Architecture demystifies the Figure, Axes, and Artist hierarchy that underpins the entire library, teaching you the object-oriented API that professionals use instead of the pyplot shortcuts.
  • Chapter 11: Essential Chart Types builds the core repertoire: line charts, bar charts, scatter plots, histograms, and box plots, with emphasis on when each form is appropriate and how to avoid common misuses.
  • Chapter 12: Customization Mastery is the chapter where your charts stop looking like defaults, covering colors, styles, labels, legends, themes, and the rcParams system that controls every visual property.
  • Chapter 13: Subplots, GridSpec, and Multi-Panel Figures teaches you to compose multiple plots into a single coherent figure, applying the layout and small-multiples principles from Part II in code.
  • Chapter 14: Specialized matplotlib Charts extends your vocabulary to heatmaps, contour plots, polar charts, error bars, and other forms that serve specific analytical needs.
  • Chapter 15: Animation and Interactivity introduces time as a visual dimension, covering FuncAnimation, interactive widgets, and the boundary where static matplotlib meets dynamic output.

Throughout these chapters, you will apply the design principles from Part II to every chart you build. The progressive project thread continues here: the climate dataset you first encountered conceptually now becomes a real figure, then a styled figure, then a multi-panel composition. Each chapter adds a layer of skill and a layer of polish.

By the end of Part III, you will be able to produce any static chart you can imagine, styled exactly the way you want, in matplotlib. Part IV introduces seaborn, which builds on this foundation to make statistical visualization faster and more expressive.

Chapters in This Part