Sunday, July 26, 2026
HomeLanguagesMatplotlib.axis.Axis.get_children() function in Python

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

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

Syntax: Axis.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.Axis.get_children() function in matplotlib.axis:

Example 1:

Python3




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


Output: 
 

List of the child Artists of this Artist

Rectangle(xy=(-0.4, 0), width=0.8, height=0.78207, angle=0)
Rectangle(xy=(0.6, 0), width=0.8, height=0.325622, angle=0)
Rectangle(xy=(1.6, 0), width=0.8, height=0.842425, angle=0)
Rectangle(xy=(2.6, 0), width=0.8, height=0.909971, angle=0)
Rectangle(xy=(3.6, 0), width=0.8, height=0.595848, angle=0)
Rectangle(xy=(4.6, 0), width=0.8, height=0.320727, angle=0)
Rectangle(xy=(5.6, 0), width=0.8, height=0.114932, angle=0)
Rectangle(xy=(6.6, 0), width=0.8, height=0.987785, angle=0)
Rectangle(xy=(7.6, 0), width=0.8, height=0.333873, angle=0)
Rectangle(xy=(8.6, 0), width=0.8, height=0.808235, angle=0)
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)

Example 2:

Python3




# Implementation of matplotlib function
from matplotlib.axis import Axis
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(),  
                height = np.random.rand(),  
                angle = np.random.rand() * 360)  
        for i in range(NUM)]  
       
fig, ax = plt.subplots(subplot_kw ={'aspect': 'equal'})  
    
print("List of the 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()), sep = "\n"
      
ax.set_xlim(3, 7)  
ax.set_ylim(3, 7)  
  
fig.suptitle("""matplotlib.axis.Axis.get_children()
function Example\n""", fontweight ="bold")  
    
plt.show()


Output: 
 

List of the child Artists of this Artist

Ellipse(xy=(6.251681831206875, 3.9966267142138587), width=0.15749720821862734, height=0.7428173898961268, angle=341.64959566060367)
Ellipse(xy=(9.694635171651406, 0.3082298935840244), width=0.43785045383108245, height=0.5349266430528582, angle=306.89814087621284)
Ellipse(xy=(1.7357826484106653, 5.411309227201636), width=0.10663934602041314, height=0.43026995252196254, angle=256.6550881336492)
Ellipse(xy=(3.6968381788725226, 9.185987209652344), width=0.6813936640135215, height=0.25300689364125084, angle=252.61131568683595)
Ellipse(xy=(7.699729644035633, 9.05640867578855), width=0.27584531777538246, height=0.6852202435681556, angle=292.8551318911685)
Ellipse(xy=(3.8055234086669287, 9.303529689962627), width=0.3397616810032148, height=0.6800670944101653, angle=343.3599117442074)
Ellipse(xy=(5.760077545935722, 3.452051266745666), width=0.9523325408974765, height=0.5890811048552818, angle=23.154917565279685)
Ellipse(xy=(0.3028385509275022, 4.348405082376353), width=0.29073052124332044, height=0.7227343559726833, angle=291.6625420556584)
Ellipse(xy=(9.356848125562445, 0.388682744998603), width=0.7551391376559045, height=0.6689726402915265, angle=29.506282994528185)
Ellipse(xy=(4.5026337961862914, 2.8818563718011103), width=0.8383255618923418, height=0.5404731893991847, angle=205.60591248148282)
Ellipse(xy=(2.4392204512519946, 3.716967027629586), width=0.477237973974457, height=0.45092408521984695, angle=9.23863308260383)
Ellipse(xy=(1.693675453843294, 5.900630379457623), width=0.8725010196211161, height=0.7887736908331072, angle=346.47313864001734)
Ellipse(xy=(3.2261195027672707, 7.391400830802653), width=0.3786901514172035, height=0.7575240210476083, angle=341.9665543049055)
Ellipse(xy=(6.427754122446987, 4.396519757211291), width=0.9987780502142212, height=0.21677557044006557, angle=39.01953674151486)
Ellipse(xy=(9.542282251932058, 6.243441448874013), width=0.7181816586220924, height=0.34087193115902903, angle=107.85345758940194)
Ellipse(xy=(0.8126321922507262, 7.229081778048356), width=0.5429698490137819, height=0.9121160656974833, angle=354.48399372344613)
Ellipse(xy=(1.5697931692991618, 6.184965389960491), width=0.13800615477220446, height=0.29905434238318707, angle=74.44925403071619)
Ellipse(xy=(4.74844769967898, 5.202457759166937), width=0.8517498537889671, height=0.12566779514902027, angle=327.3770326727686)
Ellipse(xy=(7.226241075132654, 4.391600128715984), width=0.5438182944679767, height=0.9198000527055847, angle=60.3333173286636)
Ellipse(xy=(1.0311974235486987, 0.7069241263763404), width=0.9927688013269673, height=0.30152706004900354, angle=244.07742718276535)
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
32520 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6903 POSTS0 COMMENTS
Nicole Veronica
12017 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12115 POSTS0 COMMENTS
Shaida Kate Naidoo
7023 POSTS0 COMMENTS
Ted Musemwa
7265 POSTS0 COMMENTS
Thapelo Manthata
6980 POSTS0 COMMENTS
Umr Jansen
6972 POSTS0 COMMENTS