I have found many questions on this subject, but I still cannot understand the basic steps to plot date information in python.
My timeseries is
>>> datetime_series.shape
(8736,)
>>> datetime_series
array([datetime.datetime(1979, 1, 2, 0, 0),
datetime.datetime(1979, 1, 2, 1, 0),
datetime.datetime(1979, 1, 2, 2, 0), ...,
datetime.datetime(1979, 12, 31, 21, 0),
datetime.datetime(1979, 12, 31, 22, 0),
datetime.datetime(1979, 12, 31, 23, 0)], dtype=object)
My data is
>>> data.shape
(8736,)
#contains np.nan values!!!
My code right now (my commented out is what I have tried...)
fig,ax1 = plt.subplots()
plt.plot(datetime_series,data)
#plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%d-%m'))
#plt.gca().xaxis.set_major_locator(mdates.DayLocator())
#plt.gcf().autofmt_xdate()
#ax1.set_xlim([datetime_series[0],datetime_series[-1])
ax1.set_ylabel('Cumulative windspeed over open water [m/s]')
#ax1.set_xlim( ### how do I do this??
plt.title('My title')
fig.tight_layout()
plt.show()
This produces a blank plot.
If anyone can walk me through the steps of plotting datetime , I just don't understand where to start, becuase it seems like the documentation and the stackoverflow answers all have different methods.. (for example, using plot_date versus just plt.plot()
