我们可以在Holoviews中注册点击分散点吗?

问题描述

我试图通过单击点在散点图上找到最近的邻居。 所以我需要知道点击了哪一点。在下面,我仅显示所有要点并悬停。

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)

那么可以用holoviews做到这一点吗?

解决方法

好的。 http://holoviews.org/user_guide/Custom_Interactivity.html中的Tap和DoubleTap流使您可以找到用户单击的位置。