Hi @Ikajiro
I think there are two ways to go.
- You can use a stream as shown below to react to mouse interaction with your plot.
- You can embed the nglview inside the tooltip by creating a custom html tooltip as demonstrated in this example
An example of using a stream would be something like this.
import holoviews as hv
import pandas as pd
import panel as pn
from bokeh.models import HoverTool
from holoviews import streams
hv.extension('bokeh')
df = pd.DataFrame({
"x": [1,2,3], "y": [1,2,3], "file_path": ["path1", "path2", "path3"]
})
TOOLTIPS = [("x","@x"),
("y","@y"),
("file_path","@file_path"),
]
hover = HoverTool(tooltips=TOOLTIPS)
plot = hv.Scatter(df,kdims=["x"],vdims=["y"])
plot = plot.add_dimension("file_path",dim_pos=2,vdim=True,dim_val = "file_path")
plot = plot.opts(plot=dict(tools=[hover]))
pointer = streams.PointerXY(source=plot)
@pn.depends(pointer.param.x, pointer.param.y)
def file_view(x,y):
if not x or not y:
return "hover over a point"
return (x,y)
pn.Column(
plot, file_view
).servable()