绘制 datetime.time python / matplotlib 的直方图
我正在尝试绘制 datetime.time 值的直方图。这些值被离散化为五分钟的切片。数据在列表中看起来像这样:
['17:15:00', '18:20:00', '17:15:00', '13:10:00', '17:45:00', '18:20:00']
我想绘制一个直方图或某种形式的分布图,以便可以轻松检查每次出现的次数。
注意。然后将给定的每个时间离散化。直方图中的最大箱数为 288 = (60 / 5 * 24)
我已经查看过 matplotlib.pyplot.hist 。但需要某种连续标量
I am trying to plot a histogram of datetime.time values. Where these values are discretized into five minute slices. The data looks like this, in a list:
['17:15:00', '18:20:00', '17:15:00', '13:10:00', '17:45:00', '18:20:00']
I would like to plot a histogram, or some form of distribution graph so that the number of occurrences of each time can be examined easily.
NB. Given each time is discretised then. The maximum number of bins in a histogram would be 288 = (60 / 5 * 24)
I have looked at matplotlib.pyplot.hist
. But is requires some sort of continuous scalar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我按照 David Zwicker 所说的操作并使用了秒,然后更改了 x 轴。我会看看戴夫所说的“垃圾箱”。这大致有效,并给出了每小时的柱图。
I did what David Zwicker said and used seconds, and then changed the x axis. I will look at what Dave said about 'bins'. This works roughly and gives a bar per hour plot to start with.
您必须将数据转换为两个变量,然后可以使用plotlab 绘制直方图。
you have to convert the data in two variable and then you can use plotlab to plot in histograms.