How to link plots with different axis


How would I make two linked plots where the x axis are different (but have the same number of points), and I can pan and zoom are linked. By linked I mean that if I do a box zoom on e.g. the first 5 points on one plot, the other plot will also zoom on the first five points.

E.g. if I slightly modify the linked brushing example from the doc, I can link selecting data points between the two plots, but not zooming. I tried adding range arguments, but it does not work (which I expect of course).

import numpy as np

from import output_file, show

from bokeh.layouts import column

from bokeh.plotting import figure

from bokeh.models import ColumnDataSource


source = ColumnDataSource({x0=np.arange(10), x1=2*np.arange(10), y=np.arange(10) ** 2})

p0 = figure()‘x0’, ‘y’, source=source)

p1 = figure()‘x1’, ‘y’, source=source)

p = column([p0, p1])


I do that by writting a callback for the box_select tool. If your data is all in one source, you will have ‘linked’ selection with the box_select tool. You can then update the ranges of different figures based on the selected values in different columns of the data source.