Removed unlinking streams section
"Now when you hover over the ``Image`` above, you will see the cross-sections update while the point position to the right of the ``Image`` simultaneously updates."
]
},
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "#### Unlinking streams"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "As discussed earlier, linked streams are automatically associated with any plots displaying the ``source`` of the stream. However, while testing or debugging a callback, it can be useful to disable the linking.\n",
- "\n",
- "In this example we will declare a ``RangeX`` stream which is usually linked to the x-axis range of the plot. By setting ``linked=False``, we can disable the automatic linking, so we can update the stream manually. \n",
- "\n",
- "As a simple example we declare a sine curve and then slice the curve with the provided ``x_range``."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "xs = np.linspace(0, np.pi*4)\n",
- "curve = hv.Curve((xs, np.sin(xs)))\n",
- "rangex = streams.RangeX(linked=False, x_range=curve.range('x'))\n",
- "hv.DynamicMap(lambda x_range: curve.select(x=x_range), streams=[rangex])"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "Since the stream is not linked it will not trigger events when you zoom and pan. Instead we will update the range manually by iterating over the x-values and progressively expanding the range. Observe how the curve animates when you run the loop:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "for x in xs:\n",
- " rangex.event(x_range=(0, x))"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
