plt 图关闭坐标刻度方法
对于 plt 图,可以使用 plt.xticks([])
关闭 x 轴的坐标刻度,可以使用 plt.yticks([])
关闭 y 轴的坐标刻度。
样例如下:
from matplotlib import pyplot as plt
plt.plot([1, 2, 3, 4, 5], [2, 5, 3, 7, 6], label="name")
plt.title("This is Title")
plt.show()
from matplotlib import pyplot as plt
plt.plot([1, 2, 3, 4, 5], [2, 5, 3, 7, 6], label="name")
plt.title("This is Title")
plt.xticks([])
plt.yticks([])
plt.show()
ax 图关闭坐标刻度方法
对于 ax 图,可以使用 plt.xticks([])
关闭 x 轴的坐标刻度,可以使用 plt.yticks([])
关闭 y 轴的坐标刻度。
样例如下:
from matplotlib import pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot([1, 2, 3, 4, 5], [2, 5, 3, 7, 6], label="name")
ax.set_title("This is Title")
plt.show()
from matplotlib import pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot([1, 2, 3, 4, 5], [2, 5, 3, 7, 6], label="name")
ax.set_title("This is Title")
ax.set_xticks([])
ax.set_yticks([])
plt.show()