Python中的 Matplotlib.axis.Tick.set()函数
Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。它是Python中用于二维数组图的惊人可视化库,用于处理更广泛的 SciPy 堆栈。
matplotlib.axis.Tick.set()函数
matplotlib 库的轴模块中的Tick.set()函数是一个属性批处理设置器。传递 kwargs 来设置属性。
Syntax: Tick.set(self, **kwargs)
Parameters: This method does not accepts any parameters other than **kwargs.
Return value: This method does not return any value.
下面的示例说明了 matplotlib.axis 中的 matplotlib.axis.Tick.set()函数:
示例 1:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Tick
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 2, 0.001)
s = 1 + np.sin(4 * np.pi * t)*0.2
fig, ax = plt.subplots()
ax.plot(t, s)
Tick.set(ax, xlabel ='X-Axis', ylabel ='Y-Axis',
xlim =(0, 1.5), ylim =(0.5, 1.5))
ax.grid()
fig.suptitle('matplotlib.axis.Tick.set() \
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
np.random.seed(19680801)
fig, ax = plt.subplots()
x, y, s, c = np.random.rand(4, 100)
s *= 10000
ax.scatter(x**2, y**2, s, c**2)
Tick.set(ax, xlabel ='X-Axis', ylabel ='Y-Axis',
xlim =(0, 0.5), ylim =(0, 0.5))
fig.suptitle('matplotlib.axis.Tick.set() \
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
np.random.seed(19680801)
fig, ax = plt.subplots()
x, y, s, c = np.random.rand(4, 100)
s *= 10000
ax.scatter(x**2, y**2, s, c**2)
Tick.set(ax, xlabel ='X-Axis', ylabel ='Y-Axis',
xlim =(0, 0.5), ylim =(0, 0.5))
fig.suptitle('matplotlib.axis.Tick.set() \
function Example', fontweight ="bold")
plt.show()
输出: