It depends somewhat on whether you're using the procedural (MATLAB-like) or object-oriented interface. In either case, say you wanted to label 1
, 2.5
, and 4
with a
, b
, and c
. With the procdeual interface, you could call:
plt.xticks([1, 2.5, 4], ["a", "b", "c"])
In the latter case, you would do:
ax = plt.gca()
ax.set_xticks([1, 2.5, 4])
ax.set_xticklabels(["a", "b", "c"])
or, in one step:
ax = plt.gca()
ax.set(xticks=[1, 2.5, 4], xticklabels=["a", "b", "c"])