How to hide ticks label in python but keep the ticks in place?

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

enter image description here

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)