Tue 31 May 2016 — Mon 28 May 2018

Python Charting Libraries

Last time I checked, I couldn't find any good charting libraries in Python.


This library isn't good enough. Avoid it for now:

  • Critical bug in the 'stable' version for many months.
  • Missing most of the useful ggplot2 functionality


This is based on matplotlib and statsmodels.

It changes the aesthetics, and gives you some tools to control them.

It also offers:

  • Multi-plots (grid of charts)
  • joint charts (two plots on the same chart, e.g. scatter and contour)
  • some basic stats

Mostly, you can install it and then just use the matplotlib API


Figure API

A Figure represents a complete graphic.

  • axes

An Artist represents an element within that. Artists may be nested hierarchically.

Artists know how to transform data into different spaces.

SubPlot is a non-overlapping grid-based mechanism for laying out different pieces of your graphic, see also GridSpec.

Axes is like SubPlot, but allows you to overlap. Useful for putting smaller things inside bigger things.

Artist Tutorial

  • Animation

    See FuncAnimation


This is the simple scripting version for playing around.

It's stateful.

It works out which backend to use based on your configuration file.

  • plot (line chart)
  • hist (histogram)
  • scatter (scatter plot)
  • annotate (annotate a point)
  • legend
  • title
  • savefig
  • show

Pyplot uses decorators to get the docstrings from the main API.


You can use TeX to annotate your plots.

There is a built in mathtext, which is a full port o TeX.

Or there's usetex, which looks for TeX on your machine. This can use 3rd party libraries.

Architecture of matplotlib


Separate design of charts from rendering.