In [1]:
import numpy as np
In [2]:
from bokeh.layouts import gridplot
from bokeh.plotting import figure, output_notebook, show
from bokeh.models import ColumnDataSource
In [3]:
output_notebook()
Loading BokehJS ...
In [4]:
N = 300
x = np.linspace(0, 4*np.pi, N)
y1 = np.sin(x)
y2 = np.cos(x)
In [5]:
source = ColumnDataSource(data=dict(x=x, y1=y1, y2=y2))
In [6]:
TOOLS = "pan,wheel_zoom,box_zoom,reset,save,box_select,lasso_select"

s1 = figure(tools=TOOLS, plot_width=350, plot_height=350)
s1.scatter('x', 'y1', source=source)

# Linked brushing in Bokeh is expressed by sharing data sources between
# renderers. Note below that s2.scatter is called with the `source` 
# keyword argument, and supplied with the same data source from s1.scatter
s2 = figure(tools=TOOLS, plot_width=350, plot_height=350)
s2.circle('x', 'y2', source=source)
Out[6]:
<bokeh.models.renderers.GlyphRenderer at 0x10da1eac8>
In [7]:
p = gridplot([[s1,s2]])
show(p)
Out[7]:

<Bokeh Notebook handle for In[7]>