title: Matplotlib set year on x axis
body: <p>i would like to have a plot of nasdaq market index that has on x axis the years since 1971 and on y axis the values.</p>
  
  <pre><code>dataframe = pd.read_csv('nasdaq-historical-chart.csv', usecols=[1], engine='python')
  dataset = dataframe.values
  
  df = pd.read_csv('nasdaq-historical-chart.csv',parse_dates=True)
  df['date'] = pd.to_datetime(df['date'])
  df['year'] = df['date'].dt.year
  plt.plot(dataset)
  plt.figure(figsize=(25,10))
  plt.plot(df['year'], dataset)
  plt.title('NASDAQ historical chart',fontsize=24)
  plt.xlabel('Time',fontsize=14)
  plt.ylabel('Value',fontsize=14)
  plt.tick_params(axis='both',labelsize=14)
  plt.show()
  </code></pre>
  
  <p>In this way i have the right plot but without years on x axis
  <a href="https://i.stack.imgur.com/053n7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/053n7.png" alt="enter image description here"></a></p>
  
  <p>If i put: </p>
  
  <pre><code>plt.plot(df['year'], dataset)
  </code></pre>
  
  <p>i have:
  <a href="https://i.stack.imgur.com/6CJe8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6CJe8.png" alt="enter image description here"></a></p>
  
  <p>why the plot changed? How can i modify it?</p>