matplotlib sets the label of the axis tick marks to none

Only display the tick mark, do not display the mark corresponding to the tick mark

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
# 设置ax的刻度线位置
ax.plot([1,2,3,4,5,6],[1,2,3,4,5,6])
ax.set_xticks([0, 1, 2, 3, 4, 5, 6])
# 设置ax的刻度线的标注,注意,刻度线的数目要和标注的数目保持一致
ax.set_xticklabels([0, 1, 2, 3, 4, 5, 6])
# 如果不想显示ax的刻度线的标注,直接设置为空即可
ax.set_xticklabels([])
plt.show()

insert image description here
don't show callouts
insert image description here

Guess you like

Origin blog.csdn.net/weixin_45913084/article/details/131112862