In [1]:
import numpy as np

In [2]:
from bokeh.plotting import figure, gridplot, show, output_notebook
from bokeh.models import ColumnDataSource

In [3]:
output_notebook()


BokehJS successfully loaded.

In [4]:
N = 300
x = np.linspace(0, 4*np.pi, N)
y1 = np.sin(x)
y2 = np.cos(x)

In [5]:
source = ColumnDataSource()
source.add(data=x, name='x')
source.add(data=y1, name='y1')
source.add(data=y2, name='y2')


Out[5]:
'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.scatter('x', 'y2', source=source)


Out[6]:
<bokeh.plotting.Figure at 0x1078f3950>

In [7]:
p = gridplot([[s1,s2]])
show(p)