title: shade area between 2 line plots ValueError: ordinal must be >= 1
body: <p>I have the following code which correctly renders this:</p>
  <pre><code>plt.xlabel('Date')
      plt.ylabel('Temp')
      plt.title('Min and Max temperature 2005-2014')
     
      # Plotting on the first y-axis
      minimum=new_df['min']
      maximum=new_df['max']
      plt.plot(new_df['Date'], new_df['min'], color='orange', label='Min')
      plt.plot(new_df['Date'], new_df['max'], color='olive', label='Max')
  </code></pre>
  <p><a href="https://i.stack.imgur.com/OykK6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OykK6.png" alt="enter image description here" /></a></p>
  <p>Now I need to colour the area between the 2 lines:</p>
  <p>I tried this:</p>
  <pre><code>plt.fill_between(minimum, maximum, color='#539ecd')
  </code></pre>
  <p>but then I get this error:</p>
  <pre><code>ValueError                                Traceback (most recent call last)
  /opt/conda/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
      305                 pass
      306             else:
  --&gt; 307                 return printer(obj)
      308             # Finally look for special method names
      309             method = get_real_method(obj, self.print_method)
  
  /opt/conda/lib/python3.6/site-packages/IPython/core/pylabtools.py in &lt;lambda&gt;(fig)
      225 
      226     if 'png' in formats:
  --&gt; 227         png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
      228     if 'retina' in formats or 'png2x' in formats:
      229         png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
  
  /opt/conda/lib/python3.6/site-packages/IPython/core/pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
      117 
      118     bytes_io = BytesIO()
  --&gt; 119     fig.canvas.print_figure(bytes_io, **kw)
      120     data = bytes_io.getvalue()
      121     if fmt == 'svg':
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
     2190                     orientation=orientation,
     2191                     dryrun=True,
  -&gt; 2192                     **kwargs)
     2193                 renderer = self.figure._cachedRenderer
     2194                 bbox_inches = self.figure.get_tightbbox(renderer)
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs)
      543 
      544     def print_png(self, filename_or_obj, *args, **kwargs):
  --&gt; 545         FigureCanvasAgg.draw(self)
      546         renderer = self.get_renderer()
      547         original_dpi = renderer.dpi
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in draw(self)
      462 
      463         try:
  --&gt; 464             self.figure.draw(self.renderer)
      465         finally:
      466             RendererAgg.lock.release()
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
       61     def draw_wrapper(artist, renderer, *args, **kwargs):
       62         before(artist, renderer)
  ---&gt; 63         draw(artist, renderer, *args, **kwargs)
       64         after(artist, renderer)
       65 
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/figure.py in draw(self, renderer)
     1141 
     1142             mimage._draw_list_compositing_images(
  -&gt; 1143                 renderer, self, dsu, self.suppressComposite)
     1144 
     1145             renderer.close_group('figure')
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, dsu, suppress_composite)
      137     if not_composite or not has_images:
      138         for zorder, a in dsu:
  --&gt; 139             a.draw(renderer)
      140     else:
      141         # Composite any adjacent images together
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
       61     def draw_wrapper(artist, renderer, *args, **kwargs):
       62         before(artist, renderer)
  ---&gt; 63         draw(artist, renderer, *args, **kwargs)
       64         after(artist, renderer)
       65 
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/axes/_base.py in draw(self, renderer, inframe)
     2407             renderer.stop_rasterizing()
     2408 
  -&gt; 2409         mimage._draw_list_compositing_images(renderer, self, dsu)
     2410 
     2411         renderer.close_group('axes')
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, dsu, suppress_composite)
      137     if not_composite or not has_images:
      138         for zorder, a in dsu:
  --&gt; 139             a.draw(renderer)
      140     else:
      141         # Composite any adjacent images together
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
       61     def draw_wrapper(artist, renderer, *args, **kwargs):
       62         before(artist, renderer)
  ---&gt; 63         draw(artist, renderer, *args, **kwargs)
       64         after(artist, renderer)
       65 
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/axis.py in draw(self, renderer, *args, **kwargs)
     1134         renderer.open_group(__name__)
     1135 
  -&gt; 1136         ticks_to_draw = self._update_ticks(renderer)
     1137         ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
     1138                                                                 renderer)
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/axis.py in _update_ticks(self, renderer)
      967 
      968         interval = self.get_view_interval()
  --&gt; 969         tick_tups = [t for t in self.iter_ticks()]
      970         if self._smart_bounds:
      971             # handle inverted limits
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/axis.py in &lt;listcomp&gt;(.0)
      967 
      968         interval = self.get_view_interval()
  --&gt; 969         tick_tups = [t for t in self.iter_ticks()]
      970         if self._smart_bounds:
      971             # handle inverted limits
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/axis.py in iter_ticks(self)
      910         Iterate through all of the major and minor ticks.
      911         &quot;&quot;&quot;
  --&gt; 912         majorLocs = self.major.locator()
      913         majorTicks = self.get_major_ticks(len(majorLocs))
      914         self.major.formatter.set_locs(majorLocs)
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/dates.py in __call__(self)
      981     def __call__(self):
      982         'Return the locations of the ticks'
  --&gt; 983         self.refresh()
      984         return self._locator()
      985 
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/dates.py in refresh(self)
     1001     def refresh(self):
     1002         'Refresh internal information based on current limits.'
  -&gt; 1003         dmin, dmax = self.viewlim_to_dt()
     1004         self._locator = self.get_locator(dmin, dmax)
     1005 
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/dates.py in viewlim_to_dt(self)
      758             vmin, vmax = vmax, vmin
      759 
  --&gt; 760         return num2date(vmin, self.tz), num2date(vmax, self.tz)
      761 
      762     def _get_unit(self):
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/dates.py in num2date(x, tz)
      399         tz = _get_rc_timezone()
      400     if not cbook.iterable(x):
  --&gt; 401         return _from_ordinalf(x, tz)
      402     else:
      403         x = np.asarray(x)
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/dates.py in _from_ordinalf(x, tz)
      252 
      253     ix = int(x)
  --&gt; 254     dt = datetime.datetime.fromordinal(ix).replace(tzinfo=UTC)
      255 
      256     remainder = float(x) - ix
  
  ValueError: ordinal must be &gt;= 1
  
  &lt;matplotlib.figure.Figure at 0x7fb311ea1cf8&gt;
  </code></pre>
  <p>Edit:</p>
  <p>dataframe looks like this:</p>
  <pre><code>Date  min  max  min2015  max2015
  0   2014-01-01 -160  156     -133       11
  1   2014-01-02 -267  139     -122       39
  2   2014-01-03 -267  133      -67       39
  3   2014-01-04 -261  106      -88       44
  4   2014-01-05 -150  128     -155       28
  </code></pre>
  <p>and I convert the Date to datetime type like this:</p>
  <pre><code>  new_df['Date'] =  pd.to_datetime(new_df['Date'], infer_datetime_format=True)
  </code></pre>
  <p>Edit:</p>
  <p>When I run:
  plt.fill_between(new_df['Date'], minimum, maximum)</p>
  <p>I get this error</p>
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-23-0f6fcbb48fdc&gt; in &lt;module&gt;()
       59 
       60 
  ---&gt; 61 leaflet_plot_stations(400,'fb441e62df2d58994928907a91895ec62c2c42e6cd075c2700843b89')
  
  &lt;ipython-input-23-0f6fcbb48fdc&gt; in leaflet_plot_stations(binsize, hashid)
       44     minimum = new_df['min']
       45     maximum =  new_df['max']
  ---&gt; 46     plt.fill_between(new_df['Date'], minimum, maximum)
       47     #plt.scatter(new_df['Date'], new_df['min2015'], 'o')
       48     #plt.scatter(new_df['Date'], new_df['max2015'], 'o')
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/pyplot.py in fill_between(x, y1, y2, where, interpolate, step, hold, data, **kwargs)
     2999         ret = ax.fill_between(x, y1, y2=y2, where=where,
     3000                               interpolate=interpolate, step=step, data=data,
  -&gt; 3001                               **kwargs)
     3002     finally:
     3003         ax._hold = washold
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, *args, **kwargs)
     1890                     warnings.warn(msg % (label_namer, func.__name__),
     1891                                   RuntimeWarning, stacklevel=2)
  -&gt; 1892             return func(ax, *args, **kwargs)
     1893         pre_doc = inner.__doc__
     1894         if pre_doc is None:
  
  /opt/conda/lib/python3.6/site-packages/matplotlib/axes/_axes.py in fill_between(self, x, y1, y2, where, interpolate, step, **kwargs)
     4770 
     4771         # Convert the arrays so we can work with them
  -&gt; 4772         x = ma.masked_invalid(self.convert_xunits(x))
     4773         y1 = ma.masked_invalid(self.convert_yunits(y1))
     4774         y2 = ma.masked_invalid(self.convert_yunits(y2))
  
  /opt/conda/lib/python3.6/site-packages/numpy/ma/core.py in masked_invalid(a, copy)
     2343         cls = type(a)
     2344     else:
  -&gt; 2345         condition = ~(np.isfinite(a))
     2346         cls = MaskedArray
     2347     result = a.view(cls)
  
  TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
  </code></pre>