title: pandas 0.21.0 Timestamp compatibility issue with matplotlib
body: <p>I just updated pandas from 0.17.1 to 0.21.0 to take advantage of some new functionalities, and ran into compatibility issue with matplotlib (which I also updated to latest 2.1.0). In particular, the Timestamp object seems to be changed significantly.</p>
  
  <p>I happen to have another machine still running the older versions of pandas(0.17.1)/matplotlib(1.5.1) which I used to compared the differences:</p>
  
  <p>Both versions show my DataFrame index to be <code>dtype='datetime64[ns]</code></p>
  
  <pre><code>DatetimeIndex(['2017-03-13', '2017-03-14', ... '2017-11-17'], type='datetime64[ns]', name='dates', length=170, freq=None)
  </code></pre>
  
  <p>But when calling <code>type(df.index[0])</code>, 0.17.1 gives <code>pandas.tslib.Timestamp</code> and 0.21.0 gives <code>pandas._libs.tslib.Timestamp</code>.</p>
  
  <p>When plotting with <code>df.index</code> as x-axis:</p>
  
  <pre><code>plt.plot(df.index, df['data'])
  </code></pre>
  
  <p>matplotlibs by default formats the x-axis labels as dates for pandas 0.17.1 but fails to recognize it for pandas 0.21.0 and simply gives raw number <code>1.5e18</code> (epoch time in nanosec).</p>
  
  <p>I also have a customized cursor that reports clicked location on the graph by using <code>matplotlib.dates.DateFormatter</code> on the x-value which fails for 0.21.0 with:</p>
  
  <pre><code>OverflowError: signed integer is greater than maximum
  </code></pre>
  
  <p>I can see in debug the reported x-value is around 736500 (i.e. day count since year 0) for 0.17.1 but is around 1.5e18 (i.e. nanosec epoch time) for 0.21.0.</p>
  
  <p>I am surprised at this break of compatibility between matplotlib and pandas as they are obviously used together by most people. Am I missing something in the way I call the plot function above for the newer versions?</p>
  
  <p><strong>Update</strong> as I mentioned above, I prefer directly calling <code>plot</code> with a given axes object but just for the heck of it, I tried calling the plot method of the DataFrame itself <code>df.plot()</code>. As soon as this is done, all subsequent plots correctly recognize the Timestamp <em>within the same python session</em>. It's as if an environment variable is set, because I can reload another DataFrame or create another axes with <code>subplots</code> and no where does the <code>1.5e18</code> show up. This really smells like a bug as the latest pandas doc says <a href="https://pandas.pydata.org/pandas-docs/stable/visualization.html#basic-plotting-plot" rel="noreferrer">pandas</a>:</p>
  
  <pre><code>The plot method on Series and DataFrame is just a simple wrapper around plt.plot()
  </code></pre>
  
  <p>But clearly it does something to the python session such that subsequent plots deal with the Timestamp index properly.</p>
  
  <p>In fact, simply running the example at the above pandas link:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  import matplotlib.pyplot as plt
  ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
  </code></pre>
  
  <p>Depending on whether <code>ts.plot()</code> is called or not, the following plot either correctly formats x-axis as dates or not:</p>
  
  <pre><code>plt.plot(ts.index,ts)
  plt.show()
  </code></pre>
  
  <p>Once a member plot is called, subsequently calling <code>plt.plot</code> on new Series or DataFrame will autoformat correctly without needing to call the member plot method again.</p>