Bokeh链接刷牙与自定义索引

时间:2017-03-02 03:20:36

标签: python data-visualization bokeh

假设我有一个包含列的表:id,x1,y1,x2,y2。 我想并排绘制x1 vs y1和x2 vs y2,并通过id链接刷新。关于刷新here的Bokeh文档仅显示两个图共享同一轴时的示例。

如何使用Bokeh执行此操作?

1 个答案:

答案 0 :(得分:0)

使用相同的例子,这不是你想要的吗?每个情节都有不同的x和y,但仍然相关?

from bokeh.io import output_file, show
from bokeh.layouts import gridplot
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure

output_file("brushing.html")

x = list(range(-20, 21))
x2 =list(range(-30, 10))
y0 = [abs(xx) for xx in x]
y1 = [xx**2 for xx in x2]

# create a column data source for the plots to share
source = ColumnDataSource(data=dict(x=x, x2=x2, y0=y0, y1=y1))

TOOLS = "box_select,lasso_select,help"

# create a new plot and add a renderer
left = figure(tools=TOOLS, width=300, height=300, title=None)
left.circle('x', 'y0', source=source)

# create another new plot and add a renderer
right = figure(tools=TOOLS, width=300, height=300, title=None)
right.circle('x2', 'y1', source=source)

p = gridplot([[left, right]])

show(p)