Bokeh graph doesn't plot properly

[亡魂溺海] 提交于 2019-12-02 08:39:57

OK, as far as I can tell, this is what you want (using some project sample data, since you did not provide anything to run your code with):

from bokeh.plotting import figure, show
from bokeh.sampledata.commits import data

p = figure(x_axis_type="datetime", y_axis_type="datetime")
p.circle(x=data.index, y=data.index.time)
show(p)

The datetime axis type, as the name suggests, treats the timestamps as datetimes. I.e., these are interpreted as hours of the day in the first day of the first year of Epoch. That's why the axis starts and ends with 1/01 and 1/02. You might want to use customize the tick formatter to display just the hours.

For reference, data looks like this:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!