Can we register click on scatter points in Holoviews?

272 views Asked by At

I am trying to find nearest neighbors on a scatter plot on click of point. So I need to know which point has been clicked. Below I am simply showing all points and hover.

all_points = hv.Points(
    df_all_points, ['y', 'x'],
    ['x', 'y', 'z']
)

tooltips = [
    ('Index', '@z')
]
hover = HoverTool(tooltips=tooltips)

all_points.opts(
    tools=[hover], color='black',
    line_color='black', size=10,
    width=width, height=height, 
    show_grid=True)

So is it possible to do this with holoviews ??

1

There are 1 answers

0
James A. Bednar On

Sure. The Tap and DoubleTap streams in http://holoviews.org/user_guide/Custom_Interactivity.html let you find where the user has clicked.