from matplotlib import pyplot as plt
plt.plot(range(10))
plt.tick_params(
axis='x', # changes apply to the x-axis
which='both', # both major and minor ticks are affected
bottom=False, # ticks along the bottom edge are off
top=False, # ticks along the top edge are off
labelbottom=False) # labels along the bottom edge are off
plt.show()
plt.savefig('plot')
plt.clf()
不完全是OP所要求的,但是一个简单的方法来禁用所有轴线、记号和标签,就是简单地调用:
以下是我在matplotlib mailing list上找到的另一种解决方案:
^{} 方法对于这种情况非常有用。此代码关闭主刻度和次刻度,并从x轴删除标签。
相关问题 更多 >
编程相关推荐