Set legend click_policy for decimated points

I’m trying to set click_policy to 'hide' in legend_opts for the object resulted from applying holoviews.operation.decimate on a set of hv.Points, but it doesn’t seem to have the desired effect.

Now I’m using the muted_alpha option on the underlying hv.Points to hide the points, but this is suboptimal, since hovering over the invisible points still shows the tooltip, which is cluttering the output when showing multiple curves.

I’ve tried passing legend_opts={'click_policy': 'hide'} as opts for the Overlay container, as well as for both the underlying hv.Points and for the result of decimate (actually, I also tried passing it as an argument to decimate), but to no avail.

I even tried using a hook for the bokeh plot as suggested here to directly set plot_obj.state.legend.click_policy = 'hide', but that doesn’t work either.

So, any idea on how to hide a set of decimated hv.Points completely (i.e., not showing the hover tooltips either)?

Note: I’ve followed the “Principles of datashading” section of holoviews’ user guide on “Working with large data” and used decimate as indicated there.

Turns out that you need to set the legend_opts after calling collate on the overlay in order for them to work.

2 Likes