Wednesday, July 3, 2024
HomeLanguagesPythonMatplotlib.axis.Axis.pan() function in Python

Matplotlib.axis.Axis.pan() function in Python

Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack.

Matplotlib.axis.Axis.pan() Function

The Axis.pan() function in axis module of matplotlib library is used to Pan by numsteps. 
 

Syntax: Axis.pan(self, numsteps) 
 

Parameters: This method accepts the following parameters. 

  • numsteps: This parameter is the value(positive or negative).

Return value: This method does not return any value. 

Below examples illustrate the matplotlib.axis.Axis.pan() function in matplotlib.axis:
 

Example 1:

Python3




# Implementation of matplotlib function
from matplotlib.axis import Axis
import matplotlib.pyplot as plt 
import numpy as np 
    
fig, ax = plt.subplots() 
ax.plot([1, 2, 3])  
    
ax.xaxis.pan(3)
   
ax.grid() 
   
fig.suptitle("""matplotlib.axis.Axis.pan()
function Example\n""", fontweight ="bold")  
     
plt.show()


Output: 
 

Example 2:

Python3




# Implementation of matplotlib function
from matplotlib.axis import Axis
import numpy as np 
import matplotlib.pyplot as plt 
from matplotlib.widgets import Slider, Button, RadioButtons 
       
fig, ax1 = plt.subplots() 
plt.subplots_adjust(bottom = 0.25
t = np.arange(0.0, 1.0, 0.001
a0 = 5
f0 = 3
delta_f = 5.0
s = a0 * np.sin(2 * np.pi * f0 * t) 
       
ax1.plot(t, s, lw = 2, color = 'green'
  
ax1.xaxis.pan(-2)
   
ax1.grid() 
   
fig.suptitle("""matplotlib.axis.Axis.pan()
function Example\n""", fontweight ="bold")  
     
plt.show()


Output: 
 

 

Nango Kalahttps://www.kala.co.za
Experienced Support Engineer with a demonstrated history of working in the information technology and services industry. Skilled in Microsoft Excel, Customer Service, Microsoft Word, Technical Support, and Microsoft Office. Strong information technology professional with a Microsoft Certificate Solutions Expert (Privet Cloud) focused in Information Technology from Broadband Collage Of Technology.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments