Open In App

Matplotlib.axes.Axes.get_zorder() in Python

Last Updated : 30 Apr, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.

matplotlib.axes.Axes.get_zorder() Function

The Axes.get_zorder() function in axes module of matplotlib library is used to get the artist's zorder.
Syntax: Axes.get_zorder(self) Parameters: This method does not accepts any parameter. Returns: This method return the artist's zorder.
Below examples illustrate the matplotlib.axes.Axes.get_zorder() function in matplotlib.axes: Example 1: Python3
# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
  
d = np.arange(100).reshape(10, 10)
xx, yy = np.meshgrid(np.arange(11), np.arange(11))
  
fig, ax = plt.subplots()
  
ax.set_aspect(1)
ax.pcolormesh(xx, yy, d)

ax.text(3, 9.5, "Zorder Value : "
        + str(ax.get_zorder()),
        fontweight ="bold")

fig.suptitle('matplotlib.axes.Axes.get_zorder() \
function Example', fontweight ="bold")

plt.show()
Output: Example 2: Python3
# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
  
xx = np.random.rand(16, 30)
  
fig, ax = plt.subplots()
  
ax.pcolor(xx)
ax.set_zorder(-20)

ax.set_title("Zorder Value : "
             + str(ax.get_zorder()))

fig.suptitle('matplotlib.axes.Axes.get_zorder() \
function Example', fontweight ="bold")

plt.show()
Output:

Next Article

Similar Reads