我目前正在生成以下情节:

使用此代码:
ax = plt.subplots()
ax.plot(intra.to_pydatetime(), data)
plt.title('Intraday Net Spillover')
fig.autofmt_xdate()
Run Code Online (Sandbox Code Playgroud)
哪里intra.to_pydatetime()是:
<bound method DatetimeIndex.to_pydatetime of <class 'pandas.tseries.index.DatetimeIndex'>
[2011-01-03 09:35:00, ..., 2011-01-07 16:00:00]
Length: 390, Freq: None, Timezone: None>
所以日期从2011-01-03 09:35:00,增加5分钟16:00:00,然后跳到第二天,2011-01-04 09:35:00直到2011-01-04 16:00:00,依此类推.
如何避免在第二天的16:00:00到9:30:00之间绘制间隙?我不想看到这些直线.
更新:
我会尝试这个,看看它是否工作.
只需设置两个值,即定义您不希望看作NaN(非数字)的行.Matplotlib将自动隐藏两个值之间的线.
看看这个例子:http: //matplotlib.org/examples/pylab_examples/nan_test.html