Hi, I have added a hover tool to my plot, but I only want the tool to interact with lines that have been selected via the tap tool. So when i have only one line selected, i only want the hover tool to show information about that selected line. However, when I have one line selected, the hover tool still interacts with the unselected lines. Is it possible to get the hover tool to acknowledge the selected property?
In my actual application I have many lines that are nearly overlapping. I use other widgets to modify the selected property of the data to only show the lines of interest and set the unselected lines to be invisible. But when i use the hover tool to inspect the data it continues to interact with the hidden lines making it really confusing.
Here is example code, when you select one of the two lines, the other will disappear. But you can still see the tooltip when hovering over where the points would have been. The picture below shows an example of a “ghost” tooltip that I would like to get rid of.
import bokeh.plotting
import bokeh.io
import bokeh.layouts
from bokeh.models import TapTool, HoverTool
from bokeh.models import ColumnDataSource
import pandas as pd
# Data for plot
data = pd.DataFrame({'x': [[1, 2, 3],[1,2,3]], 'y': [[3, 4, 6], [5, 3, 1]]})
s1 = ColumnDataSource(data)
# make plot
p3 = bokeh.plotting.figure()
p3.multi_line(xs='x', ys='y', width=2, source=s1, nonselection_alpha=0)
# Add tools
hover = HoverTool()
hover.tooltips = ([('x', '@x}'), ('y', '@y')])
tap = TapTool()
p3.add_tools(tap)
p3.add_tools(hover)
# Plot
layout = bokeh.layouts.layout(p3)
bokeh.io.show(layout)

