title: matplotlib bug in plot_dates?
body: <p>Just wanted to see if others thought that the following behaviour in matplotlib <code>plot_date</code> was buggy, or if it's just something I should put up with.</p>
  
  <p>I have a multi-panel plot that I set up with <code>sharex</code> to facilitate zoom/pan on all axes, and I plot time series data in both panels. However, in the second panel, all of the data happens to be invalid (in this example I mask it). </p>
  
  <pre><code>from matplotlib.pyplot import figure,show
  from datetime import datetime,timedelta
  from numpy import sin,cos,linspace,pi,ma,array
  
  fig=figure(figsize=(16,9))
  ax1=fig.add_subplot(211)
  ax2=fig.add_subplot(212,sharex=ax1)
  
  # xdata is seconds
  xdata=linspace(0,9999,10000)
  tdata=array([datetime(2000,1,1)+timedelta(seconds=ss) for ss in xdata])
  data1=ma.masked_array(sin(pi*xdata/300),mask=False)
  data2=ma.masked_array(cos(pi*xdata/300),mask=True)
  
  ax1.plot_date(tdata,data1,marker='',color='r')
  ax2.plot_date(tdata,data2,marker='',color='b')
  show()
  </code></pre>
  
  <p>I'd expect (prefer) it to just show up a blank panel, not to fail and give me a long unhelpful traceback. Is this the expected behaviour?</p>
  
  <p>Notes:</p>
  
  <ul>
  <li>This script also fails if I use <code>ax.plot(...)</code> instead of <code>ax.plot_date(...)</code></li>
  <li>It works fine (i.e. gives me an empty panel) if I just plot against <code>xdata</code>, not the datetime array <code>tsdata</code> (but I have to use <code>ax1.set_xlim(xdata[0],xdata[-1])</code> to get a sensible domain displayed):</li>
  </ul>
  
  <blockquote>
  <pre><code>   ax1.plot(xdata,data1,marker='',color='r')
     ax2.plot(xdata,data2,marker='',color='b')
     ax1.set_xlim(xdata[0],xdata[-1])
     show()
  </code></pre>
  </blockquote>
  
  <ul>
  <li>I have just realised I can rescue the above plot by forcing the <code>ax2</code> limits right before the <code>show()</code> command. I still think that the failure in the main example is inelegant:</li>
  </ul>
  
  <blockquote>
  <pre><code>   ax2.set_xlim(tdata[0],tdata[-1])
     show()
  </code></pre>
  </blockquote>
  
  <p>What do the experts think?</p>
  
  <p>Thanks!</p>
  
  <p>F.Y.I., This was on matplotlib 1.1.0, compiled from source on my PC.</p>
  
  <p>Here is the traceback that I get:</p>
  
  <pre><code>Traceback (most recent call last):
  </code></pre>
  
  <blockquote>
    <blockquote>
  <pre><code> File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/backendsbackend_gtk.py", line 395, in expose_even
  self._render_figure(self._pixmap, w, h)
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", line 75, in _render_f
  FigureCanvasAgg.draw(self)
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 401, in draw
  self.figure.draw(self.renderer)
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/figure.py", line 884, in draw
  func(*args)
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/axes.py", line 1983, in draw
  a.draw(renderer)
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/axis.py", line 1036, in draw
  ticks_to_draw = self._update_ticks(renderer)
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/axis.py", line 926, in _update_ticks
  tick_tups = [ t for t in self.iter_ticks()]
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/axis.py", line 873, in iter_ticks
  majorLocs = self.major.locator()
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/dates.py", line 749, in __call__
  self.refresh()
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/dates.py", line 758, in refresh
  dmin, dmax = self.viewlim_to_dt()
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/dates.py", line 530, in viewlim_to_dt
  return num2date(vmin, self.tz), num2date(vmax, self.tz)
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/dates.py", line 289, in num2date
  if not cbook.iterable(x): return _from_ordinalf(x, tz)
    File "/home/tchubb/local/lib/python2.7/site-packages/matplotlib/dates.py", line 203, in _from_ordinalf
  dt = datetime.datetime.fromordinal(ix)
  ValueError: ordinal must be &gt;= 1
  </code></pre>
    </blockquote>
  </blockquote>
  
  <pre><code>If you suspect this is an IPython bug, please report it at:
  https://github.com/ipython/ipython/issues
  or send an email to the mailing list at ipython-dev@scipy.org
  </code></pre>