title: Python pandas plot time-series with gap
body: <p>I am trying to plot a pandas DataFrame with TimeStamp indizes that has a time gap in its indizes. Using pandas.plot() results in linear interpolation between the last TimeStamp of the former segment and the first TimeStamp of the next. I do not want linear interpolation, nor do I want empty space between the two date segments. Is there a way to do that?</p>
  
  <p>Suppose we have a DataFrame with TimeStamp indizes:</p>
  
  <pre><code>&gt;&gt;&gt; import numpy as np
  &gt;&gt;&gt; import pandas as pd
  &gt;&gt;&gt; import matplotlib.pyplot as plt
  &gt;&gt;&gt; df = pd.DataFrame(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
  &gt;&gt;&gt; df = df.cumsum()
  </code></pre>
  
  <p>Now lets take two time chunks of it and plot it:</p>
  
  <pre><code>&gt;&gt;&gt; df = pd.concat([df['Jan 2000':'Aug 2000'], df['Jan 2001':'Aug 2001']])
  &gt;&gt;&gt; df.plot()
  &gt;&gt;&gt; plt.show()
  </code></pre>
  
  <p>The resulting plot has an interpolation line connecting the TimeStamps enclosing the gap. I cannot figure out how to upload pictures on this machine, but these pictures from <a href="https://groups.google.com/forum/#!msg/pydata/x46E9Gpac68/oO2w2TiYR4w" rel="nofollow noreferrer">Google Groups</a> show my problem (interpolated.jpg, no-interpolation.jpg and no gaps.jpg). I can recreate the first as shown above. The second is achievable by replacing all gap values with NaN (see also <a href="https://stackoverflow.com/questions/27266987/python-matplotlib-avoid-plotting-gaps">this question</a>). How can I achieve the third version, where the time gap is omitted?</p>