{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "
\n", "
Title
Curve selection streams example
\n", "
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.
\n", "
Backends
Bokeh
\n", "
Tags
streams, linked, selection, interactive
\n", "
\n", "
" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import holoviews as hv\n", "from holoviews import streams\n", "hv.extension('bokeh')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%opts NdOverlay [legend_limit=0] Curve [tools=['tap']] (line_width=10)\n", "ndoverlay = hv.NdOverlay({i: hv.Curve(np.arange(10)*i) for i in range(5)})\n", "\n", "selection = streams.Selection1D(source=ndoverlay)\n", "dmap = hv.DynamicMap(lambda index: ndoverlay[index] if index else ndoverlay.clone(),\n", " kdims=[], streams=[selection])\n", "ndoverlay + dmap" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 2 }