Bokeh RangeTool interaction between figures using different dimensions

Following the example for the RangeTool here: https://bokeh.pydata.org/en/latest/docs/gallery/range_tool.html ,
I ran into some issues. I want to have the secondary plot’s range tool brush the data on a dimension not displayed by the main plot (z in this example), and have the data in the main plot brushed according to the selection on the secondary plot. So I did the following:

import numpy as np
from bokeh.models import ColumnDataSource, RangeTool
from bokeh.layouts import column
from bokeh.plotting import figure, show

n = 10 x = np.random.random(n)
y = np.random.random(n)
z = np.arange(n) source =
ColumnDataSource(data=dict(x=x, y=y, z=z, xy=x+y))

plotxy = figure(plot_width=800, plot_height=800)
plotxy.scatter(‘x’, ‘y’, source=source)

plotz = figure(plot_width=800, plot_height=100)
plotz.line(‘z’, ‘xy’, source=source)
range_rool = RangeTool(x_range=plotz.x_range)
plotz.add_tools(range_rool)

p = column([plotxy, plotz])
show§


However, the RangeTool seems incompatible with this approach since I get:

expected an instance of type Range1d, got DataRange1d(id='13429', ...) of type DataRange1d

on the following row:

range_rool = RangeTool(x_range=plotz.x_range)

``

Changing it to

x_range=Range1d(z[0], z[-1])

``

`` makes everything appear correctly, but the brushing has no effect on the main figure.

I can get the interaction between figures I want using this instead for the secondary figure:

plotz = figure(plot_width=800, plot_height=100, tools=‘xbox_select’)
plotz.scatter(‘t’, ‘xy’, source=source)
plotz.line(‘t’, ‘xy’, source=source)


The problem here is that the BoxSelectionTool is not persistent and draggable, which is key functionality I want to have.

Am I using the wrong approach here?

Thanks!