title: Year on x-axis is pinned to January on Matplotlib
body: <p>I have a dataframe as follows.
  | Date| A | B |
  |-- | ---- | -- |
  | Jan-20| 205.0| 232.0
  | Feb-20| 328.0 | 338.0</p>
  <p>I turn the Date column into a datetime object, set it as the index and graph it.</p>
  <pre><code>df['Date'] = pd.to_datetime(df['Date'],format=&quot;%b-%y&quot;) 
  df = df.set_index(&quot;Date&quot;)
  df.plot(kind='line', figsize=(10,5), color=[&quot;#FDCE0D&quot;,&quot;#3A424A&quot;])
  </code></pre>
  <p>However I get the following x-axis where the year is under each instance of January.
  <a href="https://i.stack.imgur.com/3hxF1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3hxF1.jpg" alt="enter image description here" /></a></p>
  <p>Is there a way to have the year go next to each month, such as 'Jan 2018'? I know I can perform a
  <code>.strftime(&quot;%b %Y)</code> but I want to keep it as a datetime object as I'm overlaying shading to the graph using datetime ranges.</p>
  <p>When I try to format it the following way I get this.</p>
  <pre><code>date_fmt = mdates.DateFormatter('%b %Y')
  ax.xaxis.set_major_formatter(date_fmt)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/dlSAt.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dlSAt.jpg" alt="enter image description here" /></a></p>