title: Why is my date axis formatting broken when plotting with Pandas' built-in plot calls as opposed to via Matplotlib?
body: <p>I am plotting aggregated data in Python, using Pandas and Matlplotlib. 
  My axis customization commands are failing as a function of which of two similar functions I'm calling to make bar plots. The working case is e.g.:</p>
  
  <pre><code>import datetime
  import pandas as pd
  import numpy as np
  import matplotlib.pyplot as plt
  import matplotlib.dates as mdates
  
  def format_x_date_month_day(ax):   
      days = mdates.DayLocator()
      months = mdates.MonthLocator()  # every month
      dayFmt = mdates.DateFormatter('%D')
      monthFmt = mdates.DateFormatter('%Y-%m')
      ax.figure.autofmt_xdate()
      ax.xaxis.set_major_locator(months) 
      ax.xaxis.set_major_formatter(monthFmt)
      ax.xaxis.set_minor_locator(days)
  
  span_days = 90
  start = pd.to_datetime("1-1-2012")
  idx = pd.date_range(start, periods=span_days).tolist()
  df=pd.DataFrame(index=idx, data={'A':np.random.random(span_days), 'B':np.random.random(span_days)})
  
  plt.close('all')
  fig, ax = plt.subplots(1)
  ax.bar(df.index, df.A)      # loop over columns here to do stacked plot
  format_x_date_month_day(ax)
  plt.show()
  </code></pre>
  
  <p>(See <a href="https://matplotlib.org/gallery/lines_bars_and_markers/bar_stacked.html" rel="nofollow noreferrer">matplotlib.org</a> for example of looping to create a stacked bar plot.) This gives us</p>
  
  <p><a href="https://i.stack.imgur.com/Oc9fR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Oc9fR.png" alt="Bar plot called from Matplotlib, axis formatting by &lt;code&gt;mdates&lt;/code&gt;"></a></p>
  
  <p>Another approach that <strong>should</strong> work and be much easier is to use <code>df.plot.bar(ax=ax, stacked=True)</code>, however it does not admit date axis formatting with <code>mdates</code>:</p>
  
  <pre><code>plt.close('all')
  fig, ax = plt.subplots(1)
  df.plot.bar(ax=ax, stacked=True)
  format_x_date_month_day(ax)
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/owHO0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/owHO0.png" alt="Stacked bar with broken x-axis labeling"></a></p>
  
  <p>How can <code>mdates</code> and <code>ax.figure.autofmt_xdate()</code> be made to play nice with <code>df.plot.bar</code>?</p>