2017-03-02 76 views
0

说我有一个列的表:id,x1,y1,x2,y2。 我想绘制x1 vs y1和x2与y2并排,并通过id链接刷牙。关于链接刷牙here的Bokeh文档仅显示两个图共用同一个轴的示例。散景与自定义索引相关联刷牙

如何使用Bokeh进行此操作?

回答

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)