-
-
Notifications
You must be signed in to change notification settings - Fork 405
Closed
Labels
TRIAGENeeds triagingNeeds triaging
Description
Is your feature request related to a problem? Please describe.
Currently, the Y values returned from a tap stream are only from one of the Y axes on an overlay plot with multi_y enabled.
Describe the solution you'd like
In such a case, we need a Tap stream to return all Y values. Perhaps as a dict, mapping from the name of each y-dim to the tapped y-coordinate.
Describe alternatives you've considered
Alternative might be to have a multi_y tap callback specify y, y2, ...
as input args.. but I think this would get confusing as it's not so clear which axis is primary when just using multi_y=True
.
Additional context
Simple example of multi_y only returning one y val on tap:
Code
import numpy as np
import pandas as pd
import holoviews as hv
from holoviews.streams import Tap
import panel as pn
hv.extension('bokeh')
pn.extension('tabulator')
np.random.seed(42)
x = np.linspace(0, 10, 100)
y1 = np.sin(x) + np.random.normal(0, 0.1, 100)
y2 = np.cos(x) + np.random.normal(0, 0.1, 100) * 100
df1 = pd.DataFrame({'x': x, 'y1': y1, 'axis': 'y1'})
df2 = pd.DataFrame({'x': x, 'y2': y2, 'axis': 'y2'})
curve1 = hv.Curve(df1, kdims='x', vdims=['y1', 'axis']).opts(color='red')
curve2 = hv.Curve(df2, kdims='x', vdims=['y2', 'axis']).opts(color='blue')
overlay = (curve1 * curve2).opts(multi_y=True, width=600)
def inspect(x, y):
if y is None:
return(hv.Curve([]) * hv.Curve([]))
return hv.Curve([]) * hv.Text(x=.5, y=.5, text=f'x: {x:.2f}, y: {y:.2f}')
inspect_output = hv.DynamicMap(inspect, streams=[Tap(source=overlay)]).opts(width=600)
pn.Row((overlay + inspect_output).cols(1).opts(shared_axes=False)).servable()
GMT20240812-173722_Clip_Multiy_tap.mp4
Metadata
Metadata
Assignees
Labels
TRIAGENeeds triagingNeeds triaging