简体   繁体   English

散景折线图绘制奇怪

[英]Bokeh line chart is plotting weird

I am trying to plot chart in my data science project.我正在尝试在我的数据科学项目中绘制 plot 图表。 And I want to plot chart in this way我想用这种方式制作 plot 图表在此处输入图像描述 which is produced by Matplotlib library.由 Matplotlib 图书馆制作。 And now I want to plot in the same way.现在我想要 plot 以同样的方式。 But it gives me this way in bokeh.但它在散景中给了我这种方式。

在此处输入图像描述

My data for this in the form of python list and it is as below:我的数据以 python 列表的形式出现,如下所示:

ages = [45.0,50.0,55.0,40.0,60.0,35.0,65.0,30.0,70.0,25.0,75.0,20.0,80.0,85.0,15.0,90.0,10.0,0.0]
ageCounter = [4466,4270,3824,3576,3240,2850,2527,2358,1968,1544,981,655,419,149,132,80,17,2]

Is there any thing I am missing.有什么我想念的吗?

Thanks in advance.提前致谢。

You need to sort the arrays together by age.您需要将 arrays 按年龄排序在一起。 Bokeh plots the points in the order you pass them in. The data above is out of order which explains the "zigzag". Bokeh 按照您传入的顺序绘制点。上面的数据是乱序的,这解释了“之字形”。

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

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