Bokeh: Vbar cannot be shown for datetime xaxis

若如初见. 提交于 2019-12-19 11:40:25

问题


I prepared two ColumnDataSource which has different data set for y axis.

    plot.line('x', 'y', source=source, line_width=2)
    plot.circle('x', 'y', source=source, fill_color="blue", size=8)
    plot.vbar(x='x', top='y', source=source1, width=0.5, bottom=0, fill_color="red")#this part doesn't work.

And line and circle does work but when I tried to show the vbar for another data, it doesn't show but seems like the range of the axis is changed by the vbar codes.

I tried to show only the vbar graph on mini program. And vber is never shown for my dataframe.

And I found out there's a problem with my datetime object. The line graph can be shown for datetime object's xaxis. But I changed the code for showing vbar, it doesn't show anything. And when I changed the xaxis to just the number, like x=[1, 2, 3...] while top keeps the same, the vbar is shown.

Vbar cannot be used for datetime? Or is there another reason? I'm sure the datetime xaxis is the problem.


回答1:


Datetime axes are ultimately denominated in units of "milliseconds since epoch". For vbars to show up on a datetime axis, you will usually have to make the width much larger (0.5 means 0.5 milliseconds which is just going to be invisible at most typical scales)



来源:https://stackoverflow.com/questions/49203672/bokeh-vbar-cannot-be-shown-for-datetime-xaxis

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