Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack.
matplotlib.axis.Axis.set_zorder() Function
The Axis.set_zorder() function in axis module of matplotlib library is used to set the zorder for the artist.
Syntax: Axis.set_zorder(self, level)
Parameters: This method accepts the following parameters.
- level: This parameter contains the float value.
Return value: This method does not return any value.
Below examples illustrate the matplotlib.axis.Axis.set_zorder() function in matplotlib.axis:
Example 1:
Python3
# Implementation of matplotlib function from matplotlib.axis import Axis import numpy as np import matplotlib.pyplot as plt d = np.arange( 25 ).reshape( 5 , 5 ) xx, yy = np.meshgrid(np.arange( 6 ), np.arange( 6 )) fig, ax = plt.subplots() ax.set_aspect( 1 ) m = ax.pcolormesh(xx * * 2 , yy * * 2 , d * * 2 ) Axis.set_zorder(m, - 10 ) plt.title('matplotlib.axis.Axis.set_zorder() \ function Example\n', fontweight = "bold" ) plt.show() |
Output:
Example 2:
Python3
# Implementation of matplotlib function from matplotlib.axis import Axis import numpy as np import matplotlib.pyplot as plt xx = np.random.rand( 6 , 5 ) fig, (ax3, ax4) = plt.subplots( 1 , 2 ) m = ax3.pcolor(xx) ax3.set_title( "No Zorder value " ) m = ax4.pcolor(xx) Axis.set_zorder(m, - 7 ) ax4.set_title( "Zorder Value : -7" ) fig.suptitle('matplotlib.axis.Axis.set_zorder() \ function Example\n', fontweight = "bold" ) plt.show() |
Output: