The data series is expected to run several hours a day, more or less. I'd like to be able to visualize the data by date, but without the horizontal gaps as appear in the snapshot.
# data is a pandas dataframe
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(data['Date'], date['Temperature'])
plt.show()
I added NaN between the gaps but this only helps to remove the connecting line between them. What I'd like is either to eliminate the gap completely, or make it small so that the graph can we conveniently viewed as a continuous time series.
How do I tell matplotlib to reduce the horizontal gaps here? Thanks!
EDIT: After trying several suggestions (notably, sehan2's pointed to the right direction), the solutions were overly complicated and either didn't work, or had specific problems working with dates (as opposed to just ranges of numbers).
Finally I found this post that suggests plotting using Pandas' .plot() will automatically detect and apply broken-axes for non-date x-axis. One man's bug is another man's feature apparently.
target_col = 'Temperature'
df[target_col].plot()
plt.show()