Python中的 Matplotlib.axis.Tick.remove()函数
Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。它是Python中用于二维数组图的惊人可视化库,用于处理更广泛的 SciPy 堆栈。
Matplotlib.axis.Tick.remove()函数
matplotlib 库的轴模块中的Tick.remove()函数用于尽可能从图形中删除艺术家。
Syntax: Tick.remove(self)
Parameters: This method does not accepts any parameter.
Return value: This method return the figure after removal of the artist.
下面的示例说明了 matplotlib.axis 中的 matplotlib.axis.Tick.remove()函数:
示例 1:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Tick
import matplotlib.pyplot as plt
fig, axs = plt.subplots()
axs.plot([1, 2, 3])
# use of remove() method
Tick.remove(axs)
fig.suptitle('matplotlib.axis.Tick.remove() \
function Example', fontweight ="bold")
plt.show()
Python3
# Implementation of matplotlib function
from matplotlib.axis import Tick
import matplotlib.pyplot as plt
fig, (axs, axs2) = plt.subplots(1, 2)
gs = axs2.get_gridspec()
# use of remove() method
Tick.remove(axs)
axbig = fig.add_subplot(gs[0:, -1])
axbig.annotate("Removed one Axes",
(0.4, 0.5),
xycoords ='axes fraction',
va ='center')
fig.suptitle('matplotlib.axis.Tick.remove() \
function Example', fontweight ="bold")
plt.show()
输出:
示例 2:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Tick
import matplotlib.pyplot as plt
fig, (axs, axs2) = plt.subplots(1, 2)
gs = axs2.get_gridspec()
# use of remove() method
Tick.remove(axs)
axbig = fig.add_subplot(gs[0:, -1])
axbig.annotate("Removed one Axes",
(0.4, 0.5),
xycoords ='axes fraction',
va ='center')
fig.suptitle('matplotlib.axis.Tick.remove() \
function Example', fontweight ="bold")
plt.show()
输出: