Open In App

Matplotlib.axes.Axes.get_navigate_mode() in Python

Last Updated : 19 Apr, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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.get_navigate_mode() Function

The Axes.get_navigate_mode() Function in axes module of matplotlib library is used to get the navigation toolbar button status: ‘PAN’, ‘ZOOM’, or None.

Syntax: Axes.get_navigate_mode(self)

Parameters: This method does not accept any parameters.

Return value: This method returns navigation mode.

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




# Implementation of matplotlib function
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
    
t = np.arange(0.0, 2, 0.001)
s = 1 + np.sin(8 * np.pi * t)*0.4
    
fig, ax = plt.subplots()
ax.plot(t, s)
  
w = ax.get_navigate_mode()
  
ax.text(0.5, 1.43, "Navigate Mode : " + str(w), 
        fontweight ="bold")
  
ax.set(xlabel ='X-Axis', ylabel ='Y-Axis',
       xlim =(0, 1.5), ylim =(0.5, 1.5))
  
ax.set_title('matplotlib.axes.Axes.get_navigate_mode()\
 function Example', fontweight ="bold")
  
ax.grid()
plt.show()


Output:

Example 2:




# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(19680801)
   
fig, ax = plt.subplots()
   
x, y, s, c = np.random.rand(4, 200)
s *= 200
   
ax.scatter(x, y, s, c)
ax.set_navigate_mode("ZOOM")
w = ax.get_navigate_mode()
  
ax.text(0.3, .65, "Navigate Mode : " + str(w), 
        fontweight ="bold")
  
ax.set_title('matplotlib.axes.Axes.get_navigate_mode()\
 function Example', fontweight ="bold")
  
ax.grid()
plt.show()


Output:



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads