ABSTRACT

We introduce plotting using the matplotlib package. You will learn how to make simple 2D x-y plots and fancy plots suitable for publication, complete with legends, annotations, logarithmic axes, subplots, and insets. You will learn how to produce Greek letters and mathematical symbols using a powerful markup language called L A T E X . You will also learn how to make various kinds of contour plots and vector field plots. We provide an introduction to 3D plotting with matplotlib, although its 3D capabilities are somewhat limited. We begin with a simple but limited interface, known as PyPlot , but then move to the more powerful object-oriented interface. We also provide an overview of the object-oriented structure of matplotlib, including the important but sometimes confusing topic of backends , which is helpful in reading online documentation and for understanding interactive plotting, which we do not cover in this book.