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 a bit about the pyplot
module: pyplot
provides a MATLAB-style, procedural, state-machine interface to the underlying object-oriented library in Matplotlib.
A state machine is a system with a global status, where each operation performed on the system changes its status.
matplotlib.pyplot
is stateful because the underlying engine keeps track of the current figure and plotting area information, and plotting functions change that information. To make it clearer, we did not use...