GeoViews and Holoviews - Is it possible to make the muted data points unselectable, like Bokeh does?

That’s perfect thank you! We should definitely expose that option on the legend in some way, e.g. with a legend_opts option. For now you could use a hook:


data_plot_opts = dict(muted_alpha = 0., default_tools=['pan','box_select','reset','wheel_zoom', 'save'], active_tools =['box_select'])

y1=random.sample(range(100), 20)
x1=random.sample(range(100), 20)
x2=random.sample(range(100), 20)
y2=random.sample(range(100), 20)

df_trial1=pd.DataFrame({'y1':y1, 'x1':x1})
df_trial2=pd.DataFrame({'y2':y2, 'x2':x2})

def click_policy(plot, element):
    plot.state.legend.click_policy = 'hide'

data_profile_1 = hv.Points(df_trial1, kdims=['x1', 'y1'], label="A").opts(**data_plot_opts)
data_profile_2 = hv.Points(df_trial2, kdims=['x2', 'y2'], label="B").opts(**data_plot_opts)
pn.Column((data_profile_1*data_profile_2).opts(width=400, height=400, hooks=[click_policy]), sizing_mode='stretch_width')
1 Like