holoviews
holoviews copied to clipboard
NdOverlay Path tap select tool only works if legend_limit=0
ALL software version info
macos 12.1 (21C52) on an M1 macbook pro
python 3.8.12 hab31e5c_2_cpython conda-forge
holoviews 1.15.0 pyhd8ed1ab_0 conda-forge jupyter_client 7.3.4 pyhd8ed1ab_0 conda-forge jupyter_core 4.11.1 py38h10201cd_0 conda-forge jupyter_server 1.18.1 pyhd8ed1ab_0 conda-forge jupyterlab 3.4.5 pyhd8ed1ab_0 conda-forge jupyterlab_pygments 0.2.2 pyhd8ed1ab_0 conda-forge jupyterlab_server 2.15.0 pyhd8ed1ab_0 conda-forge jupyterlab_widgets 1.1.1 pyhd8ed1ab_0 conda-forge bokeh 2.4.3 pyhd8ed1ab_3 conda-forge
Description of expected behavior and the observed behavior
NdOverlay with Curve or Path and tap tool to select, tap only works if opts.NdOverlay(legend_limit=0)
is set.
I'm trying to setup an NdOverlay with several Paths overlaid, but tap to select only works with that option set, otherwise nothing. I Figured it out eventually but doesn't seem like desired behavior, and if so, it seems like it should be documented better.
With Curve, it seems to be tied to whether or not there is a legend shown (show_legend=False
) also makes it work again, but with Path, no legend appears either way (as in the MWE below)
I also got a weird intermediate state where tap select was only selecting single line segments instead of whole paths, but I'm not sure what was going on there.
Complete, minimal, self-contained example code that reproduces the issue
Tap select does not work with this example, but uncommenting the legend_limit line fixes it.
import holoviews as hv
import pandas as pd
import numpy as np
import holoviews as hv
from holoviews import opts
from holoviews import streams
hv.extension('bokeh')
df_list = [pd.DataFrame({'x':np.arange(10), 'y':np.sin(np.arange(10)+i)}) for i in range(5)]
path_dict = {}
for i, subset in enumerate(df_list):
path_dict[i] = hv.Path(subset)
overlay = hv.NdOverlay(path_dict)
selection = streams.Selection1D(source=overlay)
overlay.opts(
opts.Path(tools=['tap'], line_width=10),
# if the next line is uncommented, tap select works again.
# opts.NdOverlay(legend_limit=0)
)
Stack traceback and/or browser JavaScript console output
Screenshots or screencasts of the bug in action
This is an interesting find, definitely a bug.
It seems to be related to the legend_limit
default, which is 25. Which equals or exceeds the number of curves you have, which is when it breaks.
@Hoxbro In this case though (the MWE above), I'm only plotting 10 Paths. Is this somehow leading to more than 25 legend entries? With Curves, the legend being shown or not seems to be the determinant, but with Paths it seems different somehow.