I have a timeseries of data I would like to plot. In the night, when i do not collect data, I have a gap between 9 pm and 7 am which looks a bit ugly on the chart and makes it hard to read.
here is a little example to understand the issue:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df2 = pd.DataFrame({ 'A' : pd.Series(np.random.randn(4),index=list(range(4)),dtype='float32'),
'B' : pd.date_range('1/1/2000', periods=4)})
print(df2.to_string())
df2.ix[3,'B'] = pd.to_datetime('2005-01-02')
print(df2.to_string())
df2.index = df2.B
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(df2.index, df2["A"])
plt.show()
the graph from 1/1/2000 to 1/3/2000 is almost unreadable, because the plot is scaled to show also the data from 2005. is there a way to eliminate that the indices (?) from 1/3/2000 to 1/3/2005?
Thanks and cheers, E.


df2.index = df2.index.astype(str)Bis a datetime