How to use the interactive backend to manipulate the 3D plots

In order to get the full 3D effect of our plot, we will Restart the kernel before using this plot, to allow us to bring in a different backend for Matplotlib. We will import this as usual, but replace matplotlib with matplotlib notebook, as shown here:

%matplotlib notebook
# Set up figure size and DPI for screen demo
plt.rcParams['figure.figsize'] = (6,4)
plt.rcParams['figure.dpi'] = 150

From the output of the preceding code, we get a different backend. So, rather than generating a static image, we can save a PNG image (the output), with which we will use a bit of JavaScript to generate an interactive plot. There are also some widgets present on the left-hand side of the plot, as shown:

When we click and drag the output, it actually manipulates where the camera is looking within the plot. We can also go back to the previous view, reverse these changes, or revert to the original view as shown in the preceding image.

Finally, we select one of these widgets that change the limits of the axes, and download the output in PNG format. In order to place the image in a fixed format, hit the Stop button shown at the top right to stop interaction, which will create a fixed image which we can now download.

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

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