2017-03-02 75 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)