Matplotlib.axis.Tick.set_zorder() function in Python

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.Tick.set_zorder() Function
The Tick.set_zorder() function in axis module of matplotlib library is used to Set the zorder for the artist. Artists with lower zorder values are drawn first.
Syntax: Tick.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.Tick.set_zorder() function in matplotlib.axis:
Example 1:
Python3
# Implementation of matplotlib function from matplotlib.axis import Tick import numpy as np import matplotlib.pyplot as plt d = np.arange(49).reshape(7, 7) xx, yy = np.meshgrid(np.arange(8), np.arange(8)) fig, ax = plt.subplots() ax.set_aspect(1) m = ax.pcolormesh(xx**2, yy**2, d**2) Tick.set_zorder(m, -5) ax.set_title('matplotlib.axis.Tick.set_zorder() \ function Example', fontweight ="bold") plt.show() |
Output:
Example 2:
Python3
# Implementation of matplotlib function from matplotlib.axis import Tick 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) Tick.set_zorder(m, 5) ax4.set_title("Zorder Value : 5") fig.suptitle('matplotlib.axis.Tick.set_zorder() \ function Example', fontweight ="bold") plt.show() |
Output:




