ValueError: The number of FixedLocator locations (5), usually from a call to set_ticks, does not match the number of ticklabels (12)

I also stumbled across the error and found that making both your xtick_labels and xticks a list of equal length works. So in your case something like :

def month(num):
  # returns month name based on month number


num_elements = len(x)
X_Tick_List = []
X_Tick_Label_List=[]

for item in range (0,num_elements):
    X_Tick_List.append(x[item])
    X_Tick_Label_List.append(month(item+1))

plt.xticks(ticks=X_Tick_List,labels=X_Tick_LabeL_List, rotation=25,fontsize=8)
       

Leave a Comment

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