Talk Scientific plotting with matplotlib

Presented by Mike Müller (Python Academy) in Introductory tutorial track 2011 on 2011/08/26 from 09:00 to 12:30

Target audience

Python users who would like to create nice 2d plots. Engineers and scientists are typically most interested.


Basic Python skills. NumPy knowledge is helpful but not required.

Software requirements

IPython, NumPy, matplotlib


The library matplotlib provides many different types of diagrams from within Python with only few lines of code. Examples are used to exercise the use of this library.

The tutorial provides an overview how to create plots with matplotlib.

IPython in combination with pylab from matplotlib provides an interactive environment for fast testing of ideas. We will be using this for most of the tutorial.

With a simple plot we learn how to add axis labels, titles and a legend. The GUIs offers zooming, panning, changing of plot sizes and other interactive ways to modify the plot.

We will use Python to change properties of existing plots such as line colors, marker symbols, or line styles.

There several ways how to place text on plots. You will learn about the different coordinate systems relative to the a plot, the canvas or the figure.

Another topic are ticks, where to put them and how to format them to achieve publication-quality plots.

The concepts of figures, subplots, and axes and how they relate to each other will be explained with examples.

matplotlib offer many different types of plots. The tutorial introduces several of them with an example.

A more advanced topic will be creating your own plot types. We will built a stacked plot type.

Finally, we will create a small animation to explore the possibilities to visualize changes.