title: Calculate time difference, if difference greater than an hour, mark as 'missing', plot gap in line graph in that area
body: <p>I have a basic pandas dataframe in python, that takes in data and plots a line graph. Each data point involves a time. If everything runs well with the data file, ideally each time stamp is roughly 30 min different from each other. In some cases, no data comes through for more than in hour. During these times, I want to mark this timeframe as 'missing' and plot a discontinuous line graph, blatantly showing where data has been missing.</p>
  
  <p>I'm having a difficult time figuring out how to do this and even search for a solution as the problem is pretty specific. The data is 'live' where it is constantly updated so I can't just pinpoint a certain area and edit as a workaround.</p>
  
  <p>Something that looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/3UZ8R.jpg" rel="nofollow noreferrer">Example</a></p>
  
  <p>Code used to create datetime column:</p>
  
  <pre><code>#convert first time columns into one datetime column
  df['datetime'] = pd.to_datetime(df[['year', 'month', 'day', 'hour', 'minute', 'second']])
  </code></pre>
  
  <p>I have figured out how to calculate the time difference, which involved creating a new column.
  Here is that code just in case:</p>
  
  <pre><code>df['timediff'] = (df['datetime']-df['datetime'].shift().fillna(pd.to_datetime("00:00:00", format="%H:%M:%S")))
  </code></pre>
  
  <p>Basic look at dataframe:</p>
  
  <pre><code>datetime               l1    l2    l3
  2019-02-03 01:52:16   0.1   0.2   0.4
  2019-02-03 02:29:26   0.1   0.3   0.6
  2019-02-03 02:48:03   0.1   0.3   0.6
  2019-02-03 04:48:52   0.3   0.8   1.4
  2019-02-03 05:25:59   0.4   1.1   1.7
  2019-02-03 05:44:34   0.4   1.3   2.2
  </code></pre>
  
  <p>I'm just not sure how to go about creating a discontinuous 'live' plot involving the time difference.</p>
  
  <p>Thanks in advance.</p>