{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
    "    <dl class=\"dl-horizontal\">\n",
    "      <dt>Title</dt> <dd> Curve selection streams example</dd>\n",
    "      <dt>Description</dt> <dd>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.</dd>\n",
    "      <dt>Backends</dt> <dd> Bokeh</dd>\n",
    "      <dt>Tags</dt> <dd> streams, linked, selection, interactive</dd>\n",
    "    </dl>\n",
    "</div>"
   ]
  },
  {
   "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
}
