Python中的 Matplotlib.axis.Tick.update()函数
Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。它是Python中用于二维数组图的惊人可视化库,用于处理更广泛的 SciPy 堆栈。
Matplotlib.axis.Tick.update()函数
matplotlib 库的轴模块中的Tick.update()函数用于从字典道具更新此艺术家的属性。
Syntax: Tick.update(self, props)
Parameters: This method accepts the following parameters.
- props: This parameter is the dictionary of the properties.
Return value: This method does not return any value.
以下示例说明了 matplotlib.axis 中的 matplotlib.axis.Tick.update()函数:
示例 1:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Tick
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(10**7)
geeks = np.random.randn(100)
fig, ax = plt.subplots()
ax.acorr(geeks, usevlines = True,
normed = True,
maxlags = 40, lw = 3)
ax.grid(True)
prop = {'xticks': np.array([-10., -5.,
0., 5., 10.]),
'yticks': np.array([-0.2, 0.2,
0.6, 1., 1.4]),
'ylabel': None, 'xlabel': None}
Tick.update(ax, prop)
ax.set_title('matplotlib.axis.Tick.update() \
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, ax = plt.subplots()
m = ax.pcolor(xx)
m.set_zorder(-20)
prop = {'autoscalex_on': False}
Tick.update(ax, prop)
ax.set_title('matplotlib.axis.Tick.update() \
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, ax = plt.subplots()
m = ax.pcolor(xx)
m.set_zorder(-20)
prop = {'autoscalex_on': False}
Tick.update(ax, prop)
ax.set_title('matplotlib.axis.Tick.update() \
function Example', fontweight ="bold")
plt.show()
输出: