Skip to content
Related Articles

Related Articles

Matplotlib.axes.Axes.set_navigate() in Python
  • Last Updated : 19 Apr, 2020

Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.

matplotlib.axes.Axes.set_navigate() Function

The Axes.set_navigate() Function in axes module of matplotlib library is used to check whether the axes responds to navigation toolbar commands or not.

Syntax: Axes.set_navigate(self, b)

Parameters: This accept the following parameters that are described below:

  • b : This parameter contains the boolean value.

Return value: This method does not returns any value.



Below examples illustrate the matplotlib.axes.Axes.set_navigate() function in matplotlib.axes:
Example 1:




# Implementation of matplotlib function
import matplotlib.pyplot as plt
from mpl_toolkits.axisartist.axislines import SubplotZero
import numpy as np
   
  
fig, ax = plt.subplots()
   
xx = np.arange(0, 2 * np.pi, 0.01)
ax.plot(xx, np.sin(xx))
ax.set_navigate(False)
  
fig.suptitle('matplotlib.axes.Axes.set_navigate() function\
 Example\n\n', fontweight ="bold")
  
plt.show()

Output:

Example 2:




# Implementation of matplotlib function
import matplotlib.pyplot as plt
import numpy as np
      
  
fig, (ax, ax1)= plt.subplots(1, 2)
  
ax.plot([1, 2, 3])
ax.grid()
  
ax1.plot([1, 2, 3])
ax1.grid()
  
ax.set_navigate(False)
ax1.set_navigate(True)
  
ax.set_title(" set_navigate with False")
ax1.set_title(" set_navigate with True")
  
fig.suptitle('matplotlib.axes.Axes.set_navigate() function\
 Example\n\n', fontweight ="bold")
  
plt.show()

Output:
Move cursor on Axes 1:

Move cursor on Axes 2:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :