Saturday, November 22, 2025
HomeLanguagesMatplotlib.artist.Artist.draw() in Python

Matplotlib.artist.Artist.draw() in Python

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.draw() method

The draw() method in the artist module of the matplotlib library is used to draw the Artist using the given renderer.

Syntax: Artist.draw(self, renderer, \*args, \*\*kwargs)

Parameters: This method accepts the following parameters.

  • renderer: This parameter is the RendererBase subclass.

Returns: This method does not return any value.

Below examples illustrate the matplotlib.artist.Artist.draw() function in matplotlib:

Example 1:




# Implementation of matplotlib function
from matplotlib.artist import Artist
from mpl_toolkits.mplot3d import axes3d  
import matplotlib.pyplot as plt  
       
fig, ax = plt.subplots()  
       
def tellme(s):  
    ax.set_title(s, fontsize = 16)  
    fig.canvas.draw() 
    renderer = fig.canvas.renderer 
    Artist.draw(ax, renderer) 
     
tellme('matplotlib.artist.Artist.draw() function Example'
ax.grid() 
  
plt.show()


Output:

Example 2:




# Implementation of matplotlib function
from matplotlib.artist import Artist
from mpl_toolkits.mplot3d import axes3d  
import matplotlib.pyplot as plt  
       
    
fig = plt.figure()  
ax = fig.add_subplot(111, projection ='3d')  
       
X, Y, Z = axes3d.get_test_data(0.1)  
ax.plot_wireframe(X, Y, Z, rstride = 5,   
                  cstride = 5)  
       
for angle in range(0, 90):  
    ax.view_init(30, angle) 
    fig.canvas.draw() 
    renderer = fig.canvas.renderer 
    Artist.draw(ax, renderer)  
    plt.pause(.001
    
    fig.suptitle('matplotlib.artist.Artist.draw() function Example'
ax.grid() 
  
plt.show()


Output:

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

Most Popular

Dominic
32407 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6785 POSTS0 COMMENTS
Nicole Veronica
11932 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12000 POSTS0 COMMENTS
Shaida Kate Naidoo
6907 POSTS0 COMMENTS
Ted Musemwa
7168 POSTS0 COMMENTS
Thapelo Manthata
6864 POSTS0 COMMENTS
Umr Jansen
6850 POSTS0 COMMENTS