Book Image

IPython Notebook Essentials

By : Luiz Felipe Martins
Book Image

IPython Notebook Essentials

By: Luiz Felipe Martins

Overview of this book

Table of Contents (15 chapters)
IPython Notebook Essentials
About the Author
About the Reviewers

Three-dimensional plots

In this section, we present methods to display three-dimensional plots, that is, plots of mathematical objects in space. Examples include surfaces and lines that are not confined to a plate.

matplotlib has excellent support for three-dimensional plots. In this section, we will present an example of a surface plot and corresponding contour plot. The types of plot available in the three-dimensional library include wireframe plots, line plots, scatterplots, triangulated surface plots, polygon plots, and several others. The following link will help you to understand the types of plots that are not treated here:

Before we start, we need to import the three-dimensional library objects we need using the following command line:

from mpl_toolkits.mplot3d import axes3d

Now, let's draw our surface plot by running the following code in a cell:

def dist(x, y):
    return sqrt(x**2 + y**2) 
def fsurface...