def plot_timeseries(DF, ax, name, startDate, stopDate, ylim=False):
"""
plots timeseries graphs
"""
# original time series
ax.plot(DF[name],color='#1f77b4')
ax.set_ylabel(name)
ax.set_ylim(ylim)
ax.set_xlim(pd.datetime.strptime(startDate,'%Y-%m-%d'),\
pd.datetime.strptime(stopDate,'%Y-%m-%d'))
# boxcar average
ax.plot(DF[name].rolling(180).mean(),color='red')
# make the dates exact
ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d')
评论列表
文章目录