散景:无法显示日期时间X轴的Vbar [英] Bokeh: Vbar cannot be shown for datetime xaxis

查看:61
本文介绍了散景:无法显示日期时间X轴的Vbar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我准备了两个ColumnDataSource,它们的y轴数据集不同.

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.

直线和圆弧确实有效,但是当我尝试显示其他数据的vbar时,它没有显示,但是好像轴的范围已被vbar代码更改了.

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.

我试图仅在小程序上显示vbar图. 而且vber从未显示在我的数据框中.

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

我发现我的datetime对象有问题. 可以为日期时间对象的x轴显示折线图. 但是我更改了显示vbar的代码,但没有显示任何内容. 然后,当我将xaxis更改为数字时,例如x = [1、2、3 ...],而top保持不变,则会显示vbar.

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不能用于日期时间吗? 还是还有其他原因? 我确定datetime xaxis是问题所在.

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

推荐答案

日期时间轴最终以自纪元以来的毫秒数"为单位.为了使vbar出现在日期时间轴上,通常必须使宽度 很多 变大(0.5表示0.5毫秒,这在大多数典型比例下都是不可见的) )

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)

这篇关于散景:无法显示日期时间X轴的Vbar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆