Chapter 4. Advanced Matplotlib
We are about to explore some advanced aspects of Matplotlib. The topics that we are going to cover in detail are:
Matplotlib's object-oriented interface
Subplots and multiple figures
Additional and shared axes
Logarithmic scaled axes
Date plotting with ticks formatting and locators
Text properties, fonts, LaTeX typewriting
Contour plots and image plotting
The basis for all of these topics is the object-oriented interface, so we will learn about that first.
Object-oriented versus MATLAB styles
So far in this book, we have seen a lot of examples, and in all of them we used the matplotlib.pyplot
module to create and manipulate the plots, but this is not the only way to make use of the Matplotlib plotting power.
There are three ways to use Matplotlib:
pyplot:
The module used so far in this bookpylab:
A module to merge Matplotlib and NumPy together in an environment closer to MATLABObject-oriented way: The Pythonic way to interface with Matplotlib
Let's first elaborate...