Here is a slightly simpler answer, using ax.tick_params
import matplotlib.pylab as plt
fig, ax = plt.subplots()
plt.plot([1,2,3],[4,5,6])
ax.tick_params(labelbottom=False)
plt.show()
Here is the resulting output in Matplotlib 3
As commented by @chris, one can similarly hide the labels on any of the other axes using labeltop
, labelleft
, labelright
, in the above example, instead of labelbottom
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…