Thursday, October 2, 2025
HomeLanguagesMatplotlib.axis.Tick.get_children() in Python

Matplotlib.axis.Tick.get_children() in Python

matplotlib.axis.Tick.get_children() Function in axis module of matplotlib library is used to get the list of the child Artists of this Artist. 

Syntax: Tick.get_children(self) 
Parameters: This method does not accepts any parameter. 
Return value: This method return the list of the child Artists of this Artist. 

Below examples illustrate the matplotlib.axis.Tick.get_children() function in matplotlib.axis:

Example 1: 

Python3




# Implementation of matplotlib function
from matplotlib.axis import Tick
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import numpy as np
from numpy.random import rand
  
fig, ax2 = plt.subplots()
  
ax2.hexbin(range(10), rand(10), picker=True)
  
print("First 10 child Artists of this Artist \n",
      *list(ax2.get_children())[:10], sep="\n")
  
fig.suptitle("""matplotlib.axis.Tick.get_children()
function Example\n""", fontweight="bold")
  
plt.show()


Output: 

 

First 10 child Artists of this Artist 

<matplotlib.collections.PolyCollection object at 0x0AF49930>
Spine
Spine
Spine
Spine
XAxis(80.0,52.8)
YAxis(80.0,52.8)
Text(0.5, 1.0, '')
Text(0.0, 1.0, '')
Text(1.0, 1.0, '')

Example 2: 

Python3




# Implementation of matplotlib function
from matplotlib.axis import Tick
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Ellipse
  
NUM = 20
  
ells = [Ellipse(xy=np.random.rand(2) * 10,
                width=np.random.rand()*4,
                height=np.random.rand()*4,
                angle=np.random.rand() * 360)
        for i in range(NUM)]
  
fig, ax = plt.subplots(subplot_kw={'aspect': 'equal'})
  
print("Last 10 child Artists of this Artist \n")
for e in ells:
    ax.add_artist(e)
    e.set_clip_box(ax.bbox)
    e.set_alpha(np.random.rand())
    e.set_facecolor(np.random.rand(4))
  
print(*list(ax.get_children())[-10:], sep="\n")
  
ax.set_xlim(0, 10)
ax.set_ylim(0, 10)
  
fig.suptitle("""matplotlib.axis.Tick.get_children()
function Example\n""", fontweight="bold")
  
plt.show()


Output: 

 

Last 10 child Artists of this Artist 

Spine
Spine
Spine
Spine
XAxis(80.0,52.8)
YAxis(80.0,52.8)
Text(0.5, 1.0, '')
Text(0.0, 1.0, '')
Text(1.0, 1.0, '')
Rectangle(xy=(0, 0), width=1, height=1, angle=0)
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32331 POSTS0 COMMENTS
Milvus
85 POSTS0 COMMENTS
Nango Kala
6703 POSTS0 COMMENTS
Nicole Veronica
11867 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11926 POSTS0 COMMENTS
Shaida Kate Naidoo
6818 POSTS0 COMMENTS
Ted Musemwa
7079 POSTS0 COMMENTS
Thapelo Manthata
6775 POSTS0 COMMENTS
Umr Jansen
6776 POSTS0 COMMENTS