Table + Selection1D + gridmatrix?

Hello, The following code:

import holoviews as hv
from holoviews import opts
from bokeh.sampledata.iris import flowers
from holoviews.operation import gridmatrix
hv.extension('bokeh')
iris_ds = hv.Dataset(flowers)

table = hv.Table(flowers)

sel1 = hv.streams.Selection1D(source=table)

table
grid = gridmatrix(iris_ds, diagonal_type=hv.Distribution, chart_type=hv.Points)

layout = (grid + table).opts(
    opts.Layout(merge_tools=True, shared_datasource=True),
    opts.GridMatrix(shared_datasource=True),
    opts.Points(shared_datasource=True, tools=['box_select']))

sel2 = hv.streams.Selection1D(source=table)

layout

If the first 2 cells are executed and a selection on table is performed, sel1 as expected returns the selected index or indices. If the third cell is executed, and a selection in one of the gridmatrix’s plots is performed, sel2 doesn’t return any index or indices.

How can I have sel2 return data?

I’m not quite following here; the source for sel2 isn’t the gridmatrix, it’s the table, so it wouldn’t be affected by making a selection on the gridmatrix. Are you asking how to set up a selection where the source is the gridmatrix?

… so it wouldn’t be affected by making a selection on the gridmatrix …

If that is true, and to answer your question, yes.

Perhaps accessing one of the gridmatrix’s underlying bokeh plot will yield what is selected?

I’m confused. In your code, the selection works fine on the standalone table. It also works fine when the table is alongside a GridMatrix in a Layout, as long as shared_datasource=False. But once shared_datasource=True, Selection1D(source=table) doesn’t ever contain anything, nor does Selection1D(source=grid), whether I’m selecting on the grid or the table. Somehow the grid is interfering with Selection1D? Maybe @philippjfr can explain.

That’s consistent with my experiences too. It seems that the issue resides somewhere in GridMatrix.

Thanks for looking into this!