I am currently creating a plot below:

using this code:
ax = plt.subplots()
ax.plot(intra.to_pydatetime(), data)
plt.title('Intraday Net Spillover')
fig.autofmt_xdate()
where intra.to_pydatetime()is:
<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>
So, dates start with 2011-01-03 09:35:00, increase by 5 minutes before 16:00:00, and then move on the next day, 2011-01-04 09:35:00to 2011-01-04 16:00:00, etc.
How can I avoid scheduling between 16:00:00 and 9:30:00 the next day? I do not want to see these lines.
UPDATE:
I will try this one to see if it works.
source
share