Python/Bokeh:禁用隐藏字形的悬停工具(通过交互式图例) [英] Python/Bokeh: Disable hover tool for hidden glyphs (via interactive legend)
问题描述
自bokeh 0.12.5起,可以使用交互式图例,可通过在图例框中单击来隐藏或隐藏字形.这是一个很棒的功能,尤其是对于更复杂的地块.
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"
show(p)
这是结果图(不隐藏):
This is the resulting plot (without hiding):
这是第2行被隐藏但具有活动悬停工具提示的图:
This is the plot with Line 2 being hidden but having an active hover tooltip:
我当前是否缺少用于停用隐藏字形的悬停工具提示的选项?如果没有,那么有谁能想到一个简短的解决方法(也许采用CustomCS)?
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)?
谢谢!
推荐答案
从bokeh 0.12.6开始,它已修复.有关更多信息,请参见github repo 此处.
As of bokeh 0.12.6, it is fixed. For more, see the issue in the github repo here.
这篇关于Python/Bokeh:禁用隐藏字形的悬停工具(通过交互式图例)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!