我想用python编写一段代码,以条形图的大小为小时数绘制日期时间直方图。
我试过一些代码,但结果不正确。我犯了个大错我不明白。在numtime = [date2num(t) for t in x]
# plotting the histogram
ax = figure().gca()
_, _, patches = hist(numtime, bins=24,alpha=.5)
# adding the labels for the x axis
tks = [num2date(p.get_x()) for p in patches]
xticks(tks,rotation=40)
# formatting the dates on the x axis
ax.xaxis.set_major_formatter(DateFormatter('%d %b %H:%M'))
show()
x is of datetime
我刚开始学习python。有人能帮忙吗。
用于复制的几个x值:
^{pr2}$