Open In App

Matplotlib.artist.Artist.axes in Python

Last Updated : 12 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. The Artist class contains Abstract base class for objects that render into a FigureCanvas. All visible elements in a figure are subclasses of Artist.

Matplotlib.artist.Artist.axes() property 

The axes() property in artist module of matplotlib library is the Axes instance the artist resides in, or None

property: Artist.axes

Below examples illustrate the matplotlib.artist.Artist.axes() property in matplotlib:

Example 1:

python3
# Implementation of matplotlib function
from matplotlib.artist import Artist 
import matplotlib.pyplot as plt  


# providing values to x and y  
x = [8, 5, 11, 13, 16, 23] 
y = [14, 8, 21, 7, 12, 15] 
  
# to plot x and y 
plt.plot(x, y) 

# use of axes() property
axs = Artist.axes
plt.text(8.5, 14, str(axs), fontweight="bold")

plt.title("""matplotlib.artist.Artist.axes()
property Example""", fontweight="bold")

plt.show()

Output:

Example 2:

python3
# Implementation of matplotlib function
from matplotlib.artist import Artist 
import matplotlib.pyplot as plt  


# providing values to x and y  
x = [8, 5, 11, 13, 16, 23] 
y = [14, 8, 21, 7, 12, 15] 
  
# to plot x and y 
plt.plot(x, y) 
plt.axes(facecolor = 'black')

axs = Artist.axes
print(str(axs))

plt.title("""matplotlib.artist.Artist.axes()
property Example""", fontweight="bold")

plt.show()

Output:


Practice Tags :

Similar Reads