title: Plot non continuous data with lines using python matplotlib
body: <p>I have a need to plot data with matplotlib that is a series, but has some values missing, so it's not entirely continuous. Currently the data is in the form of simple lists, with one value for each "N" value shown, from 15 to 40, so there is a list of those values, passed as the x information to the plotting command. The data is passed as a list for the y information, and currently possesses either a number of numpy.nan, for places where there is no data for this set.</p>
  
  <p>What I need to do is plot it as shown, except that I need the missing datapoints to be ignored and the lines to connect between the next data points, for instance the red circle at x=20 should connect to the red circle at x=35, and the two markers are being plotted by the same plot command.</p>
  
  <p><a href="https://i.stack.imgur.com/folEi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/folEi.png" alt="Sample plot"></a></p>
  
  <p>This code needs to plot various data sets, where some will have no data at 15, but it needs to be shown that there is no data, i.e. the axes remain the same for clarity and series are connected to show trends.</p>
  
  <p>sample data for the red circle data:</p>
  
  <pre><code>[numpy.nan, 6.3, numpy.nan, numpy.nan, 8.4, numpy.nan]
  </code></pre>
  
  <p>sample data for the green circle data:</p>
  
  <pre><code>[numpy.nan, 4.1, 4.3, numpy.nan, 5.8, nunmpy.nan]
  
  fig = plt.figure(figsize=(16,9))
  ax = fig.add_subplot(111)
  ax.plot(plens, polyplot, linestyle='--', marker='^', markersize=7.0, color='red')
  </code></pre>
  
  <p>I have left aside the superfluous information, like the indexing of colours and labelling as they are not important to the problem. Thanks.</p>