import numpy as np
from bokeh.layouts import gridplot
from bokeh.plotting import figure, output_notebook, show
from bokeh.models import ColumnDataSource
x = list(range(11))
y0 = x
y1 = [10-xx for xx in x]
y2 = [abs(xx-5) for xx in x]
# create a new plot
s1 = figure(width=250, plot_height=250, title=None)
s1.circle(x, 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>
# 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
p = gridplot([[s1, s2, s3]], toolbar_location=None)
# show the results
show(p)
# pan the plots below
<Bokeh Notebook handle for In[7]>