Using Hover with a large dictionary of Curves

Looking for a recommendation on best approach to identify the source of a Curve in a Holoviews/Datashader plot with many Curves. My dataset has hundreds of Curves and maybe 16 million data points total across all of them. The resulting plot will have tons of overlap, but there are various outliers and I want to know which Curves they come from.

With Holoviews only, plotting a dictionary with a few curves obviously shows the source (key) of the curve when you hover, but of course this isn’t available on elements where Datashader is applied.

I’ve seen the following example, where a subset of Points are plotted to enable the Hover, but that is reduced from one large set of Points (rather than a dict of many Points elements) as the range of the plot changes with zooming. Seems like it will be more-complex in my case of many Curves:
https://github.com/ltalirz/holoviews-dynamic-hover/blob/master/dynamic_overlay.py

Any suggestions about the most efficient way to identify a Curve amongst many?

1 Like

Hi @CrashLandonB

Try adding a simplified, minimum, reproducible example. That will make it easier to understand what you exactly need and answer the question.

Here’s an example of a dict of Curves. How can I create some points I can use for a “hover” indication of what curve is which? I tried using rolling_outlier_std, but didn’t work so i removed my code for that.

import numpy as np
import holoviews as hv
from holoviews.operation.datashader import datashade, rasterize
from holoviews.operation.timeseries import resample, rolling_outlier_std
from holoviews import opts
import panel as pn
import datashader as ds

hv.renderer('bokeh')

print('Generating data...')
samples = 100000
index = np.arange(samples)
data = np.cumsum(np.random.random([30, samples])*100 - 50, axis=1)

print('Defining Curve dict...')
curve_dict = {str(key): hv.Curve((index, signal)) for key, signal in enumerate(data)}

# creating overlay with rasterize  creates single-color plot:
print('Creating overlay...')
overlay = rasterize(hv.NdOverlay(curve_dict), line_width=2, aggregator=ds.count())\
                    .opts(width=1000, height=400, cnorm='eq_hist')

print('Serving plot...')
pn.serve(overlay)

My actual implementation might have a few hundred Curves, each with >100k points, and so I think I’ll eventually need to figure out a solution that uses the streams approach to create points based on the current zoomed window range, but a more static set of points would be a great start for now.

@jbednar pointed out that some relevant work is being done in Directly support HoloViews-style inspect operations · Issue #1126 · holoviz/datashader · GitHub