Open In App

Matplotlib.artist.Artist.axes 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. 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:




# 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:




# 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:



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