Friday, August 29, 2025
HomeLanguagesMatplotlib.artist.Artist.set() in Python

Matplotlib.artist.Artist.set() 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.set() method

The set() method in artist module of matplotlib library is a property batch setter. Pass kwargs to set properties.

Syntax: Artist.set(self, **kwargs)

Parameters: This method does not accepts any parameters other than **kwargs.

Returns: This method does not return any value.

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

Example 1:




# Implementation of matplotlib function
from matplotlib.artist import Artist
import matplotlib 
import matplotlib.pyplot as plt 
import numpy as np 
     
  
t = np.arange(0.0, 2, 0.001
s = 1 + np.sin(8 * np.pi * t)*0.4
     
fig, ax = plt.subplots() 
ax.plot(t, s) 
     
Artist.set(ax, xlabel ='X-Axis', ylabel ='Y-Axis'
    xlim =(0, 1.5), ylim =(0.5, 1.5), 
    title ='matplotlib.artist.Artist.set() function Example'
  
ax.grid() 
  
plt.show()


Output:

Example 2:




# Implementation of matplotlib function
from matplotlib.artist import Artist
import numpy as np 
import matplotlib.pyplot as plt 
np.random.seed(19680801
    
  
fig, ax = plt.subplots() 
    
x, y, s, c = np.random.rand(4, 200
s *= 200
    
ax.scatter(x, y, s, c)
  
Artist.set(ax, xlabel ='X-Axis', ylabel ='Y-Axis'
   xlim =(0, 0.5), ylim =(0, 0.5), 
   title ='matplotlib.artist.Artist.set() 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
32249 POSTS0 COMMENTS
Milvus
80 POSTS0 COMMENTS
Nango Kala
6617 POSTS0 COMMENTS
Nicole Veronica
11789 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11838 POSTS0 COMMENTS
Shaida Kate Naidoo
6731 POSTS0 COMMENTS
Ted Musemwa
7011 POSTS0 COMMENTS
Thapelo Manthata
6688 POSTS0 COMMENTS
Umr Jansen
6701 POSTS0 COMMENTS