-
Book Overview & Buying
-
Table Of Contents
Matplotlib for Python Developers
In the previous chapter, all the plots were made of points with lines joining them. The points are the pairs (x,y) from the X and Y input lists we pass to plot(); lines are the straight segments connecting any two adjacent points.
Points are almost invisible, if not for the edges in the graph. However, they are the real generators of the plot because points mark positions. As a result, they are called markers in Matplotlib terminology.
By default, Matplotlib draws markers as a single dot and lines as straight thin segments; there are situations where we would like to change either the marker style (to clearly identify them in the plot) or the line style (so that the line appears dashed, for example).
plot() supports an optional third argument that contains a format string for each pair of X, Y arguments in the form of:
plt.plot(X, Y, '<format>', ...)
There are three levels of customization:
Colors
Line styles
Marker styles
Each of them can be represented by a given...