简体   繁体   English

散景线图循环

[英]Bokeh line graph looping

I've been working on bokeh plots and I'm trying to plot a line graph taking values from a database.我一直在研究散景图,我正在尝试绘制一个从数据库中获取值的折线图。 But the plot kind of traces back to the initial point and I don't want that.但是情节可以追溯到初始点,我不希望那样。 I want a plot which starts at one point and stops at a certain point (and circle back).我想要一个从一个点开始并在某个点停止(然后返回)的图。 I've tried plotting it on other tools like SQLite browser and Excel and the plot seems ok which means I must be doing something wrong with the bokeh stuff and that the data points itself are not in error.我尝试在 SQLite 浏览器和 Excel 等其他工具上绘制它,并且该图看起来不错,这意味着我一定在散景方面做错了,并且数据点本身没有错误。

I've attached the images for reference and the line of code doing the line plot.我已附上图像以供参考,并附上了进行折线图的代码行。 Is there something I've missed?有什么我错过了吗?

>>> image = fig.line(“x”, “y”, color=color, source=something) 

(Assume x and y are integer values and I've specified x and y ranges as DataRange1d(bounds=(0,None)) ) (假设xy是整数值,我已将xy范围指定为DataRange1d(bounds=(0,None))

在此处输入图片说明

在此处输入图片说明

Bokeh does not "auto-close" lines.散景不会“自动关闭”线条。 You can see this is the case by looking at any number of examples in the docs and repository, but here is one in particular:通过查看文档和存储库中的任意数量的示例,您可以看到这种情况,但这里有一个特别的:

http://docs.bokeh.org/en/latest/docs/gallery/stocks.html http://docs.bokeh.org/en/latest/docs/gallery/stocks.html

Bokeh's .line method will only "close up" if that is what is in the data (ie, if the last point in the data is a repeat of the first point).如果这是数据中的内容(即,如果数据中的最后一个点是第一个点的重复),则 Bokeh 的.line方法只会“关闭”。 I suggest you actually inspect the data values in source.data and I believe you will find this to be the case.我建议您实际检查source.data的数据值,我相信您会发现情况确实如此。 Then the question is why is that the case and how to prevent it from doing that, but that is not really a Bokeh question.那么问题是为什么会这样以及如何防止它这样做,但这并不是真正的散景问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM