HomeLanguagesMatplotlib.axes.Axes.set_rasterization_zorder() in Python

Matplotlib.axes.Axes.set_rasterization_zorder() in Python

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.set_rasterization_zorder() Function

The Axes.set_rasterization_zorder() function in axes module of matplotlib library is used to return y formatted as an y-value.

Syntax: Axes.set_rasterization_zorder(self, z)

Parameters:
z : This parameter is the zorder below which artists are rasterized.

Return value: This method does not return any value.

Below examples illustrate the matplotlib.axes.Axes.set_rasterization_zorder() function in matplotlib.axes:

Example 1:




# 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)
m = ax.pcolormesh(xx, yy, d)
m.set_zorder(-15)
ax.set_rasterization_zorder(-5)
  
fig.suptitle('matplotlib.axes.Axes.set_rasterization_zorder()\
 function Example', fontweight ="bold")
plt.show()


Output:

Example 2:




# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
  
xx = np.random.rand(16, 30)
  
fig, (ax3, ax4) = plt.subplots(1, 2)
  
m = ax3.pcolor(xx)
m.set_zorder(-20)
  
ax3.set_title("No Rasterization")
  
m = ax4.pcolor(xx)
m.set_zorder(-20)
  
ax4.set_rasterization_zorder(-10)
  
ax4.set_title("Rasterization z$<-10$")
  
fig.suptitle('matplotlib.axes.Axes.set_rasterization_zorder()\
 function Example', fontweight ="bold")
plt.show()


Output:

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32541 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6920 POSTS0 COMMENTS
Nicole Veronica
12036 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12143 POSTS0 COMMENTS
Shaida Kate Naidoo
7055 POSTS0 COMMENTS
Ted Musemwa
7292 POSTS0 COMMENTS
Thapelo Manthata
7014 POSTS0 COMMENTS
Umr Jansen
7000 POSTS0 COMMENTS