Open In App

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

Last Updated : 15 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

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

The Axis.get_major_formatter() function in axis module of matplotlib library is used to get the formatter of the major ticker.

Syntax: Axis.get_major_formatter(self)

Parameters: This method does not accepts any parameters.

Return value: This method returns the formatter of the major ticker.

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

Example 1:

Python3
# Implementation of matplotlib function 
import numpy as np
from matplotlib.axis import Axis  
import matplotlib.pyplot as plt   
  
x = np.linspace(0, 10, 1000) 
y = 0.000001 * np.sin(10 * x) 
  
fig = plt.figure() 
ax = fig.add_subplot(111) 
  
ax.plot(x, y) 

print(Axis.get_major_formatter(ax.yaxis))

plt.title("Matplotlib.axis.Axis.get_major_formatter()\n\
Function Example", fontsize = 12, fontweight ='bold') 
plt.show()

Output:

<matplotlib.ticker.ScalarFormatter object at 0x08497E30>

Example 2:

Python3
# Implementation of matplotlib function 
import numpy as np
from matplotlib.axis import Axis  
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.grid()  

print(Axis.get_major_formatter(ax.xaxis))

plt.title("Matplotlib.axis.Axis.get_major_formatter()\n\
Function Example", fontsize = 12, fontweight ='bold') 
plt.show()

Output:

<matplotlib.ticker.ScalarFormatter object at 0x084E9F10>

Practice Tags :

Similar Reads

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy