what worked for me is setting the length of tick dynamically to same as the number of labels so :
labels =["label1","label2"] plt.xticks(np.arange(len(labels)), labels)