title: ValueError: The number of FixedLocator locations (5), usually from a call to set_ticks, does not match the number of ticklabels (12)
body: <p>this piece of code was working before, however, after creating a new environment , it stopped working for the line</p>
  <pre><code>plt.xticks(x, months, rotation=25,fontsize=8)
  </code></pre>
  <p>if i comment this line then no error, after putting this line error is thrown</p>
  <pre><code>ValueError: The number of FixedLocator locations (5), usually from a call to set_ticks, does not match the number of ticklabels (12).
  </code></pre>
  <hr />
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  dataset = df
  dfsize = dataset[df.columns[0]].size
  x = []
  for i in range(dfsize):
      x.append(i)
  
  dataset.shape
  # dataset.dropna(inplace=True)
  dataset.columns.values
  var = &quot;&quot;
  for i in range(dataset.shape[1]):  ## 1 is for column, dataset.shape[1] calculate length of col
  
      y = dataset[dataset.columns[i]].values
      y = y.astype(float)
      y = y.reshape(-1, 1)
      y.shape
      from sklearn.impute import SimpleImputer
  
      missingvalues = SimpleImputer(missing_values=np.nan, strategy='mean', verbose=0)
      missingvalues = missingvalues.fit(y)
      y = missingvalues.transform(y[:, :])
  
      from sklearn.preprocessing import LabelEncoder, OneHotEncoder
      from sklearn.compose import ColumnTransformer
  
      labelencoder_x = LabelEncoder()
      x = labelencoder_x.fit_transform(x)
  
      from scipy.interpolate import *
  
      p1 = np.polyfit(x, y, 1)
      # from matplotlib.pyplot import *
      import matplotlib
      matplotlib.use('Agg')
      import matplotlib.pyplot as plt
  
      plt.figure()
      plt.xticks(x, months, rotation=25,fontsize=8)
      #print(&quot;--&gt;&quot;+dataset.columns[i])
      plt.suptitle(dataset.columns[i] + ' (xyz)', fontsize=10)
      plt.xlabel('month', fontsize=8)
      plt.ylabel('Age', fontsize=10)
      plt.plot(x, y, y, 'r-', linestyle='-', marker='o')
      plt.plot(x, np.polyval(p1, x), 'b-')
      y = y.round(decimals=2)
      for a, b in zip(x, y):
          plt.text(a, b, str(b), bbox=dict(facecolor='yellow', alpha=0.9))
  
      plt.grid()
      # plt.pause(2)
      # plt.grid()
  
      var = var + &quot;,&quot; + dataset.columns[i]
      plt.savefig(path3 + dataset.columns[i] + '_1.png')
      plt.close(path3 + dataset.columns[i] + '_1.png')
      plt.close('all')
  </code></pre>