# Plot
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1, axisbg='white')
# Plot actual data
plt.plot_date(x=x1, y=y1, fmt='o-')
# Now append the extra data
x1.append(date_end)
x2 = mdates.date2num(x1)
plt.plot(x1,p(x2),'r ') #add trendline to plot
plt.title('Cash Bucks')
plt.ylabel('Cash Bucks')
plt.xlabel('Date')
fig.autofmt_xdate() # This tidies up the x axis
plt.show()
在绘制实际数据之后,需要将}。在
end_date
附加到x1
之后,在绘制趋势线之前,用新的附加值重新生成{所以,脚本的结尾将是:
我还为您添加了
fig.autofmt_xdate()
,这使得x轴的标签更好一些相关问题 更多 >
编程相关推荐