Title
Curve selection streams example
Description
A linked streams example demonstrating how to use the Selection1D stream to access Curves selected using a tap tool on one plot and mirror them on another plot.
Backends
Bokeh
Tags
streams, linked, selection, interactive

In [ ]:
import numpy as np
import holoviews as hv
from holoviews import opts
from holoviews import streams
hv.extension('bokeh')

In [ ]:
ndoverlay = hv.NdOverlay({i: hv.Curve(np.arange(10)*i) for i in range(5)})

selection = streams.Selection1D(source=ndoverlay)
dmap = hv.DynamicMap(lambda index: ndoverlay[index] if index else ndoverlay.clone(),
                     kdims=[], streams=[selection])
layout = ndoverlay + dmap
layout.opts(
    opts.Curve(tools=['tap'], line_width=10),
    opts.NdOverlay(legend_limit=0))