简体   繁体   English

散景:绘制大型数据集

[英]Bokeh: plotting a large data set

I am trying to construct a graph that is very similar to the range_tool.py example 我正在尝试构建与range_tool.py示例非常相似的图

https://docs.bokeh.org/en/latest/docs/gallery/range_tool.html https://docs.bokeh.org/en/latest/docs/gallery/range_tool.html

Instead of using date time data, I have two lists each one is over 40,000 data points long. 我没有使用日期时间数据,而是有两个列表,每个列表的长度超过40,000个数据点。

Example lists: 示例列表:

b = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] phred = [17, 16, 6, 15, 6, 7, 6, 7, 9, 11, 16, 13, 9, 11, 12, 13, 6, 12, 13, 7] I want to plot b vs p and get the same image visualization as in the above link. b = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] phred = [17, 16, 6, 15, 6, 7, 6, 7, 9, 11, 16, 13, 9, 11, 12, 13, 6, 12, 13, 7]我想绘制b vs p并得到与在上面的链接中。 The goal is to see the distribution of phred over b. 目的是查看phr在b上的分布。 The below code returns a graph but I want to better visualize the variability in phred over b and I am unsure about what settings to tweek so it looks more like the above example. 下面的代码返回一个图形,但是我想更好地可视化phr上的变化,我不确定tweek的设置,所以看起来更像上面的示例。

from bokeh.io import show
from bokeh.layouts import column
from bokeh.models import ColumnDataSource, RangeTool
from bokeh.plotting import figure

p = figure(plot_height=300, plot_width=800, tools="", toolbar_location=None, x_range=(0, 50000))

p.line(b, phred)
p.yaxis.axis_label = 'phred score'

select = figure(plot_height=150, plot_width=800, y_range=p.y_range, y_axis_type=None, tools="", toolbar_location=None)

range_rool = RangeTool(x_range=p.x_range)
range_rool.overlay.fill_color = "navy"
range_rool.overlay.fill_alpha = 0.2

select.line(b, phred)
select.ygrid.grid_line_color = None
select.add_tools(range_rool)
select.toolbar.active_multi = range_rool

show(column(p, select))

Here is my graph 这是我的图

bokeh plot 散景图

You are using "p" as name for the figure and one of your data lists! 您使用“ p”作为图形名称和数据列表之一!

You have to pass the list objects, not their names as strings. 您必须传递列表对象,而不是将其名称作为字符串传递。

Try: 尝试:

b = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
c = [17, 16, 6, 15, 6, 7, 6, 7, 9, 11, 16, 13, 9, 11, 12, 13, 6, 12, 13, 7]
p.line(b, c)

After playing around I found out the simple fix to better see the data was in line 1 在玩了之后,我发现了简单的解决方法,以便更好地查看数据在第1行中

setting the plot's first x_range to a smaller number x_range=(0, 2000) 将图的第一个x_range设置为较小的数字x_range=(0, 2000)

This setting improves the plot improved bokeh plot 此设置改善了情节, 改善了散景情节

If anyone has any suggestions on how to view such variable data please share 如果有人对如何查看此类可变数据有任何建议,请分享

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

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