Matplotlib.artist.Artist.update() 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.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 functionfrom matplotlib.artist import Artistimport 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.2, 0.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 functionfrom matplotlib.artist import Artistimport 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:



