title: Add months to xaxis and legend on a matplotlib line plot
body: <p>I am trying to plot stacked yearly line graphs by months. 
  I have a dataframe df_year as below:</p>
  
  <pre><code>Day                    Number of Bicycle Hires            
  2010-07-30                     6897
  
  2010-07-31                     5564
  
  2010-08-01                     4303
  
  2010-08-02                     6642
  
  2010-08-03                     7966
  </code></pre>
  
  <p>with the index set to the date going from 2010 July to 2017 July</p>
  
  <p>I want to plot a line graph for each year with the xaxis being months from Jan to Dec and only the total sum per month is plotted </p>
  
  <p>I have achieved this by converting the dataframe to a pivot table as below:</p>
  
  <pre><code>pt = pd.pivot_table(df_year, index=df_year.index.month, columns=df_year.index.year, aggfunc='sum')
  </code></pre>
  
  <p>This creates the pivot table as below which I can plot as show in the attached figure:</p>
  
  <pre><code>  Number of Bicycle Hires    2010      2011       2012      2013       2014   
  1                      NaN  403178.0   494325.0  565589.0   493870.0   
  2                      NaN  398292.0   481826.0  516588.0   522940.0   
  3                      NaN  556155.0   818209.0  504611.0   757864.0   
  4                      NaN  673639.0   649473.0  658230.0   805571.0   
  5                      NaN  722072.0   926952.0  749934.0   890709.0  
  </code></pre>
  
  <p>plot showing yearly data with months on xaxis</p>
  
  <p><a href="https://i.stack.imgur.com/FSCGN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FSCGN.png" alt="enter image description here"></a></p>
  
  <p>The only problem is that the months show up as integers and I would like them to be shown as Jan, Feb .... Dec with each line representing one year. And I am unable to add a legend for each year.  </p>
  
  <p>I have tried the following code to achieve this:</p>
  
  <pre><code>dims = (15,5)
  fig, ax = plt.subplots(figsize=dims)
  ax.plot(pt)
  
  months = MonthLocator(range(1, 13), bymonthday=1, interval=1)
  monthsFmt = DateFormatter("%b '%y")
  ax.xaxis.set_major_locator(months) #adding this makes the month ints disapper
  ax.xaxis.set_major_formatter(monthsFmt)
  handles, labels = ax.get_legend_handles_labels() #legend is nowhere on the plot
  ax.legend(handles, labels)
  </code></pre>
  
  <p>Please can anyone help me out with this, what am I doing incorrectly here? </p>
  
  <p>Thanks!</p>