We installed matplotlib and IPython in Chapter 1, Getting Started with Python Libraries. Please go back to that chapter if you need to. The procedural MATLAB-like matplotlib API is considered by many as simpler to use than the object-oriented API, so we will demonstrate this procedural API first. To create a very basic plot in matplotlib, we need to invoke the
plot() function in the
matplotlib.pyplot subpackage. This function produces a two-dimensional plot for a single list or multiple lists of points with known x and y coordinates.
Optionally, we can pass a format parameter, for instance, to specify a dashed line style. The list of format options and parameters for the
plot() function is pretty long, but easy to look up ...