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]:
Loading BokehJS ...
In [4]:
x = list(range(11))
y0 = x
y1 = [10-xx for xx in x]
y2 = [abs(xx-5) for xx in x]
In [5]:
# create a new plot
s1 = figure(width=250, plot_height=250, title=None), y0, size=10, color="navy", alpha=0.5)

# Linked panning in Bokeh is expressed by sharing ranges between
# plots. Note below that s2 is reated with the `x_range` and `y_range` 
# keyword arguments, and supplied with the same ranges from s1. Here, 
# this links both axes together.
s2 = figure(width=250, height=250, x_range=s1.x_range, y_range=s1.y_range, title=None)
s2.triangle(x, y1, size=10, color="firebrick", alpha=0.5)

# It is possible to share just one range or the other, to link plots
# along only one dimension. For the third plot, we only link the x-axis
s3 = figure(width=250, height=250, x_range=s1.x_range, title=None)
s3.square(x, y2, size=10, color="olive", alpha=0.5)
<bokeh.models.renderers.GlyphRenderer at 0x10db1e710>
In [6]:
# by default we can't pan outside the range of the data. Disable bounds for this demo
s1.x_range.bounds = s2.x_range.bounds = s2.x_range.bounds = None
s1.y_range.bounds = s2.y_range.bounds = s2.y_range.bounds = None
In [7]:
p = gridplot([[s1, s2, s3]], toolbar_location=None)

# show the results

# pan the plots below

<Bokeh Notebook handle for In[7]>

In [ ]: