Open In App

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

Improve
Improve
Like Article
Like
Save
Share
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_minorticklabels() Function

The Axis.get_minorticklabels() function in axis module of matplotlib library is used to get the list of Text instances for the minor ticklabels.
 

Syntax: Axis.get_minorticklabels(self) 

Parameters: This method does not accepts any parameter. 
 

Return value: This method returns the list of Text instances for the minor ticklabels. 

Below examples illustrate the matplotlib.axis.Axis.get_minorticklabels() 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
import matplotlib.ticker as ticker
      
np.random.seed(19680801)
   
fig, ax = plt.subplots()
ax.plot(100*np.random.rand(20))
   
Axis.set_minor_locator(ax.xaxis, ticker.MultipleLocator(1)) 
   
print("Value of get_minorticklabels() :")
for i in ax.xaxis.get_minorticklabels():
    print(i)
       
plt.title("Matplotlib.axis.Axis.get_minorticklabels()\n\
Function Example", fontsize = 12, fontweight ='bold'
  
plt.show()


Output: 
 

 

Value of get_minorticklabels() :
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')
Text(0, 0, '')

Example 2:

Python3




# Implementation of matplotlib function 
import numpy as np
from matplotlib.axis import Axis  
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
   
fig, ax = plt.subplots()
ax.plot(np.random.rand(1000),'go')
   
Axis.set_minor_locator(ax.yaxis, ticker.MultipleLocator(1))
  
print("Value of get_minorticklabels() :")
for i in ax.yaxis.get_minorticklabels():
    print(i)
       
plt.title("Matplotlib.axis.Axis.get_minorticklabels()\n\
Function Example", fontsize = 12, fontweight ='bold'
  
plt.show()


Output: 
 

 

Value of get_minorticklabels() :
Text(0, 0, '')
Text(0, 0, '')


Last Updated : 03 Jun, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads