title: Put a gap/break in a line plot
body: <p>I have a data set with effectively "continuous" sensor readings, with the occasional gap.</p>
  
  <p>However there are several periods in which no data was recorded.  These gaps are significantly longer than the sample period.</p>
  
  <p>By default, pyplot connects each data point to the next (if I have a line style set), however I feel that this is slightly misleading when it connects the two data points either side of a long gap.</p>
  
  <p>I would prefer to simply have no line there; that is, I would like the line to stop and to start again after the gap.</p>
  
  <p>I have tried adding in an element in these gap sections with the y-value <code>None</code>, but seems to send the line back to an earlier part of the plot (though strangely these lines don't appear at all zoom levels).</p>
  
  <p>The other option I have thought of is to simply plot each piece with a separate call to <code>plot</code>, but this would be a bit ugly and cumbersome.</p>
  
  <p>Is there a more elegant way of achieving this?</p>
  
  <p>Edit:  Below is a minimal working example demonstrating the behaviour.  The first plot is the joining line I am trying to avoid.  The second plot shows that adding a <code>None</code> value appears to work, however if you pan the view of the plot, you get what is shown in the third figure, a line jumping to an earlier part of the plot.</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  t1 = np.arange(0, 8, 0.05)
  t2 = np.arange(10, 14, 0.05)
  t = np.concatenate([t1, t2])
  c = np.cos(t)
  
  fig = plt.figure()
  ax = fig.gca()
  ax.plot(t, c)
  ax.set_title('Undesirable joining line')
  
  
  t1 = np.arange(0, 8, 0.05)
  t2 = np.arange(10, 14, 0.05)
  c1 = np.cos(t1)
  c2 = np.cos(t2)
  t = np.concatenate([t1, t1[-1:], t2])
  c = np.concatenate([c1, [None,], c2])
  
  fig = plt.figure()
  ax = fig.gca()
  ax.plot(t, c)
  ax.set_title('Ok if you don\'t pan the plot')
  
  fig = plt.figure()
  ax = fig.gca()
  ax.plot(t, c)
  ax.axis([-1, 12, -0.5, 1.25])
  ax.set_title('Strange jumping line')
  
  plt.show()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/MysYv.png" alt="Plot 3, the &quot;strange jumping line&quot;"></p>