import matplotlib.pyplot as plt
ax = plt.gca()
ax.plot(range(10), range(10), 'ko')
#store the yticks locator
l = ax.yaxis.get_major_locator()
#hide ticks and display the figure
ax.set_yticks([])
plt.gcf().show()
raw_input('pause') # => no more yticks
#restore the tick locator to its originale state
ax.yaxis.set_major_locator(l)
plt.gcf().canvas.draw() #refresh the plot to sow the yticks again
plt.show()
您可以在调用set_yticks([])之前存储tick定位器,并在以后恢复它
相关问题 更多 >
编程相关推荐