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