Since bokeh 0.12.5 it is possible to use interactive legends
to hide or mute glyphs via clicking on them in the legend box. This is a great feature especially for more complex plots.
However, when used in conjunction with the hover tool
, hidden glyphs should not trigger the hover tool because the user is provided with a tooltip for glyphs which are not visible (due to muting via the interactive legend).
Here is minimal code example for clarification:
import numpy as np
from bokeh.plotting import figure, show, output_notebook
x = np.arange(0, 10, 1)
p = figure(tools=["hover"])
p.line(x, x, legend="Line 1")
p.line(x, x/2, legend="Line 2")
p.legend.click_policy = "hide"
This is the resulting plot (without hiding):
This is the plot with Line 2 being hidden but having an active hover tooltip:
Is there an option I'm currently missing to deactivate hover tooltips for hidden glyphs? If not, does anyone can think of a short workaround (perhaps employing CustomCS)?