title: matplotlib plots strange horizontal lines on graph
body: <p>I have used openpyxl to read data from an Excel spreadsheet into a pandas data frame, called 'tides'. The dataset contains over 32,000 rows of data (of tide times in the UK measured every 15 minutes). One of the columns contains date and time information (variable called 'datetime') and another contains the height of the tide (called 'tide'):</p>
  
  <p>I want to plot datetime along the x-axis and tide on the y axis using:</p>
  
  <pre><code>import numpy        as np
  import matplotlib       as mpl
  import matplotlib.pyplot    as plt
  import pandas       as pd
  import openpyxl
  import datetime     as dt
  from matplotlib.dates import date2num
  
  &lt;-- Data imported from Excel spreadsheet into DataFrame using openpyxl. --&gt;
  &lt;-- Code omitted for ease of reading.                                   --&gt;
  
  # Convert datatime variable to datetime64 format:
  tides['datetime'] = pd.to_datetime(tides['datetime'])
  
  # Plot figure of 'datetime' vs 'tide':
  fig = plt.figure()
  ax_tides = fig.add_subplot(1,1,1)
  ax_tides.plot_date(date2num(phj_tides['datetime']),phj_tides['tide'],'-',xdate=True,label='Tides 2011',linewidth=0.5)
  
  min_datetime = dt.datetime.strptime('01/01/2011 00:00:00',"%d/%m/%Y %H:%M:%S")
  max_datetime = dt.datetime.strptime('03/01/2011 23:59:45',"%d/%m/%Y %H:%M:%S")
  ax_tides.set_xlim( [min_datetime, max_datetime] )
  
  plt.show()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/ZCqbU.png" alt="enter image description here"></p>
  
  <p>The plot shows just the first few days of data. However, at the change from one day to the next, something strange happens; after the last point of day 1, the line disappears off to the right and then returns to plot the first point of the second day - but the data is plotted incorrectly on the y axis. This happens throughout the dataset. A printout shows that the data seems to be OK.</p>
  
  <pre><code>    number            datetime   tide
  0        1 2011-01-01 00:00:00  4.296
  1        2 2011-01-01 00:15:00  4.024
  2        3 2011-01-01 00:30:00  3.768
  3        4 2011-01-01 00:45:00  3.521
  4        5 2011-01-01 01:00:00  3.292
  5        6 2011-01-01 01:15:00  3.081
  6        7 2011-01-01 01:30:00  2.887
  7        8 2011-01-01 01:45:00  2.718
  8        9 2011-01-01 02:00:00  2.577
  9       10 2011-01-01 02:15:00  2.470
  10      11 2011-01-01 02:30:00  2.403
  11      12 2011-01-01 02:45:00  2.389
  12      13 2011-01-01 03:00:00  2.417
  13      14 2011-01-01 03:15:00  2.492
  14      15 2011-01-01 03:30:00  2.611
  15      16 2011-01-01 03:45:00  2.785
  16      17 2011-01-01 04:00:00  3.020
  17      18 2011-01-01 04:15:00  3.314
  18      19 2011-01-01 04:30:00  3.665
  19      20 2011-01-01 04:45:00  4.059
  20      21 2011-01-01 05:00:00  4.483
  
  [21 rows x 3 columns]
       number            datetime   tide
  90       91 2011-01-01 22:30:00  7.329
  91       92 2011-01-01 22:45:00  7.014
  92       93 2011-01-01 23:00:00  6.690
  93       94 2011-01-01 23:15:00  6.352
  94       95 2011-01-01 23:30:00  6.016
  95       96 2011-01-01 23:45:00  5.690
  96       97 2011-02-01 00:00:00  5.366
  97       98 2011-02-01 00:15:00  5.043
  98       99 2011-02-01 00:30:00  4.729
  99      100 2011-02-01 00:45:00  4.426
  100     101 2011-02-01 01:00:00  4.123
  101     102 2011-02-01 01:15:00  3.832
  102     103 2011-02-01 01:30:00  3.562
  103     104 2011-02-01 01:45:00  3.303
  104     105 2011-02-01 02:00:00  3.055
  105     106 2011-02-01 02:15:00  2.827
  106     107 2011-02-01 02:30:00  2.620
  107     108 2011-02-01 02:45:00  2.434
  108     109 2011-02-01 03:00:00  2.268
  109     110 2011-02-01 03:15:00  2.141
  110     111 2011-02-01 03:30:00  2.060
  
  [21 rows x 3 columns]
         number            datetime   tide
  35020   35021 2011-12-31 19:00:00  5.123
  35021   35022 2011-12-31 19:15:00  4.838
  35022   35023 2011-12-31 19:30:00  4.551
  35023   35024 2011-12-31 19:45:00  4.279
  35024   35025 2011-12-31 20:00:00  4.033
  35025   35026 2011-12-31 20:15:00  3.803
  35026   35027 2011-12-31 20:30:00  3.617
  35027   35028 2011-12-31 20:45:00  3.438
  35028   35029 2011-12-31 21:00:00  3.278
  35029   35030 2011-12-31 21:15:00  3.141
  35030   35031 2011-12-31 21:30:00  3.019
  35031   35032 2011-12-31 21:45:00  2.942
  35032   35033 2011-12-31 22:00:00  2.909
  35033   35034 2011-12-31 22:15:00  2.918
  35034   35035 2011-12-31 22:30:00  2.923
  35035   35036 2011-12-31 22:45:00  2.985
  35036   35037 2011-12-31 23:00:00  3.075
  35037   35038 2011-12-31 23:15:00  3.242
  35038   35039 2011-12-31 23:30:00  3.442
  35039   35040 2011-12-31 23:45:00  3.671
  </code></pre>
  
  <p>I am at a loss to explain this. Can anyone explain what is happening, why it is happening and how can I correct it?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Phil</p>