散景链接刷与自定义索引
Bokeh linked brushing with custom index
假设我有一个 table 列:id、x1、y1、x2、y2。
我想并排绘制 x1 vs y1 和 x2 vs y2,并通过 id 链接刷牙。关于链接刷亮的 Bokeh 文档 here 仅显示两个绘图共享同一个轴时的示例。
如何使用 Bokeh 执行此操作?
用同样的例子,这不是你想要的吗?每个图都有不同的 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)
假设我有一个 table 列:id、x1、y1、x2、y2。 我想并排绘制 x1 vs y1 和 x2 vs y2,并通过 id 链接刷牙。关于链接刷亮的 Bokeh 文档 here 仅显示两个绘图共享同一个轴时的示例。
如何使用 Bokeh 执行此操作?
用同样的例子,这不是你想要的吗?每个图都有不同的 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)