Python中的 Matplotlib.axis.Axis.set_zorder()函数
Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。它是Python中用于二维数组图的惊人可视化库,用于处理更广泛的 SciPy 堆栈。
matplotlib.axis.Axis.set_zorder()函数
matplotlib 库的轴模块中的Axis.set_zorder()函数用于为艺术家设置 zorder。
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.
下面的示例说明了 matplotlib.axis 中的 matplotlib.axis.Axis.set_zorder()函数:
示例 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()
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()
输出:
示例 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()
输出: