RangeXY#
Download this notebook from GitHub (right-click to download).
Title: RangeXY stream example#
Description: A linked streams example demonstrating how to use multiple Selection1D streams on separate Points objects.
Dependencies: Bokeh
import numpy as np
import holoviews as hv
hv.extension('bokeh')
# Define an image
Y, X = (np.mgrid[0:100, 0:100]-50.)/20.
img = hv.Image(np.sin(X**2+Y**2))
def selected_hist(x_range, y_range):
# Apply current ranges
obj = img.select(x=x_range, y=y_range) if x_range and y_range else img
# Compute histogram
return hv.operation.histogram(obj)
# Define a RangeXY stream linked to the image
rangexy = hv.streams.RangeXY(source=img)
# Adjoin the dynamic histogram computed based on the current ranges
img << hv.DynamicMap(selected_hist, streams=[rangexy])
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.
Download this notebook from GitHub (right-click to download).