HomeLanguagesMatplotlib.axis.Axis.get_tick_space() function in Python

Matplotlib.axis.Axis.get_tick_space() 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.get_tick_space() Function

The Axis.get_tick_space() function in axis module of matplotlib library is used to get the estimated number of ticks that can fit on the axis. 

Syntax: Axis.get_tick_space(self) 
 

Parameters: This method does not accepts any parameters. 
 

Return value: This method return the estimated number of ticks that can fit on the axis. 

Below examples illustrate the matplotlib.axis.Axis.get_tick_space() 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 
      
      
X = np.arange(-5, 5, 1) 
Y = np.arange(-5, 5, 1) 
U, V = np.meshgrid(X, Y) 
        
fig, ax = plt.subplots() 
ax.quiver(X, Y, U, V)
  
w = ax.xaxis.get_tick_space() 
      
print("Value Return :\n"+str(w)) 
     
fig.suptitle("""matplotlib.axis.Axis.get_tick_space()
function Example\n""", fontweight ="bold")  
         
plt.show()


Output: 

 

Value Return :
11

Example 2:

Python3




# Implementation of matplotlib function 
from matplotlib.axis import Axis
import numpy as np
import matplotlib.pyplot as plt
   
fig, ax2 = plt.subplots(sharex = True)
fig.subplots_adjust(left=0.2, wspace=0.6)
box = dict(facecolor='green', pad=5, alpha=0.2)
   
ax2.plot(20*np.random.rand(10))
ax2.set_xlabel('X - Label', bbox=box)
ax2.set_xlim(0, 10)
Axis.set_label_coords(ax2.xaxis, 0.5, 0.95)
  
w = ax2.xaxis.get_tick_space() 
      
print("Value Return :\n"+str(w)) 
     
fig.suptitle("""matplotlib.axis.Axis.get_tick_space()
function Example\n""", fontweight ="bold")  
         
plt.show()


Output: 

 

Value Return :
10
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32688 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7057 POSTS0 COMMENTS
Nicole Veronica
12198 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12293 POSTS0 COMMENTS
Shaida Kate Naidoo
7182 POSTS0 COMMENTS
Ted Musemwa
7447 POSTS0 COMMENTS
Thapelo Manthata
7160 POSTS0 COMMENTS
Umr Jansen
7150 POSTS0 COMMENTS