How to add 3D axes to a figure

We will use the Matplotlib inline magic in Jupyter Notebook to create our plotting setup. Begin by making a new figure and add some axes to this figure. Add a subplot, as shown in the following code, along with the projection= '3D' keyword argument:

# Make a Axes3D
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

We see that the axes generated are indeed 3D, with an orthogonal projection shown in the following output:

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

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