Interactive navigation toolbar

To access the interactive navigation toolbar in a Jupyter Notebook, first call the Jupyter cell magic:

%matplotlib notebook

We will demonstrate with a plot with a more dynamic shape:

import numpy as np
import matplotlib.pyplot as plt

y = np.linspace(1,2000)
x = 1.0/np.sin(y)

plt.plot(x,y,'green')
plt.xlim(-20,20)
plt.ylim(1000,2400)

plt.show()

As shown in the illustration, here we have a Christmas-tree-shaped plot embedded within a GUI box:

You can find a tool bar in the bottom-left corner. The button functions from left to right are as follows:

  • Home logo: Reset original view
  • Left arrow: Back to previous view
  • Right arrow: Forward to next view
  • Four-direction arrow: Pan by holding down the left mouse key; zoom with the right arrow key on the screen
  • Rectangle: Zoom by dragging rectangle on the plot
  • Floppy disk icon: Download the plot

Here is an example of panning by dragging on the plot:

The following illustration shows the result of zooming by dragging a rectangle over the plot:

To revert to inline output mode, use the cell magic %matplotlib inline, or click on the power button in the top-right corner.

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

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