Skip to content
Related Articles

Related Articles

Matplotlib.artist.Artist.update() in Python

Improve Article
Save Article
  • Last Updated : 10 May, 2020
Improve Article
Save Article

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

The update() method in artist module of matplotlib library is used to update this artist’s properties from the dictionary props.

Syntax: Artist.update(self, props)

Parameters: This method accepts the following parameters.

  • props: This parameter is the dictionary of the properties.

Returns: This method does not return any value.

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

Example 1:




# Implementation of matplotlib function
from matplotlib.artist import Artist
import matplotlib.pyplot as plt 
import numpy as np 
  
          
np.random.seed(10**7
geeks = np.random.randn(100
     
fig, ax = plt.subplots() 
ax.acorr(geeks, usevlines = True
         normed = True
         maxlags = 80, lw = 3
    
ax.grid(True
    
prop = {'xticks': np.array([-10., -5.,
                            0., 5., 10.]), 
        'yticks': np.array([-0.20.2
                            0.6, 1., 1.4]), 
        'ylabel': None, 'xlabel': None
    
Artist.update(ax, prop) 
           
fig.suptitle('matplotlib.artist.Artist.update()\
 function Example', fontweight ="bold"
  
plt.show()

Output:

Example 2:




# Implementation of matplotlib function
from matplotlib.artist import Artist
import numpy as np  
import matplotlib.pyplot as plt  
    
    
xx = np.random.rand(16, 30)  
       
fig, ax = plt.subplots()  
       
m = ax.pcolor(xx)  
m.set_zorder(-20
prop = {'autoscalex_on': False}
  
Artist.update(ax, prop) 
           
fig.suptitle('matplotlib.artist.Artist.update() \
function Example', fontweight ="bold"
  
plt.show()

Output:


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!