Linked Panning

"Linked Panning" is the capability of updating multiple plot ranges simultaneously as a result of panning one plot. In Bokeh, linked panning is acheived by shared x_range and/or y_range values between plots.

Exeute the cells below and pan the resulting plots.


In [ ]:
from bokeh.io import output_notebook, show
from bokeh.layouts import gridplot
from bokeh.plotting import figure
output_notebook()

In [ ]:
x = list(range(11))
y0 = x
y1 = [10-xx for xx in x]
y2 = [abs(xx-5) for xx in x]

In [ ]:
# create a new plot
s1 = figure(width=250, plot_height=250, title=None)
s1.circle(x, y0, size=10, color="navy", alpha=0.5)

# create a new plot and share both ranges
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)

# create a new plot and share only one range
s3 = figure(width=250, height=250, x_range=s1.x_range, title=None)
s3.square(x, y2, size=10, color="olive", alpha=0.5)

In [ ]:
p = gridplot([[s1, s2, s3]], toolbar_location=None)

In [ ]:
show(p)

In [ ]: