Chapter 9. Plotting with matplotlib

matplotlib is a very useful Python plotting library. It integrates nicely with NumPy but is a separate open source project. You can find a gallery of beautiful examples at http://matplotlib.org/gallery.html.

matplotlib also has utility functions to download and manipulate data from Yahoo Finance. We will see several examples of stock charts.

This chapter features extended coverage of the following topics:

  • Simple plots
  • Subplots
  • Histograms
  • Plot customization
  • Three-dimensional plots
  • Contour plots
  • Animation
  • Logplots

Simple plots

The matplotlib.pyplot package contains functionality for simple plots. It is important to remember that each subsequent function call changes the state of the current plot. Eventually, we will want to either save the plot in a file or display it with the show() function. However, if we are in IPython running on a Qt or Wx backend, the figure updates interactively without waiting for the show() function. This is comparable to the way text output is printed on the fly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset