【问题标题】:Python/Bokeh: Hover tool does not display when hiding glyphs via interactive legendPython/Bokeh:通过交互式图例隐藏字形时不显示悬停工具
【发布时间】:2018-05-25 19:48:16
【问题描述】:

在使用交互式图例时,我注意到隐藏字形会阻止悬停工具读取图例中其下方的字形。 IE 如果我将三行列为 line1、line2 和 line3,那么我通过交互式图例隐藏 line2,悬停工具不适用于 line3,但它适用于 line1。

示例代码sn-p

import numpy as np
from bokeh.plotting import figure, show, output_notebook

x = np.arange(0, 10, 1)
x2 = x/2
x3=x/4

p = figure(tools=["hover"])
p.line(x, x, legend="Line 1")
p.line(x, x2, legend="Line 2")
p.line(x, x3, legend='Line 3')

p.legend.click_policy = "hide"
show(p)

没有隐藏字形

隐藏 line2 和悬停工具不适用于 line3

但是悬停工具仍然适用于 line1

我假设这是与上一个问题相关的错误,其中悬停工具仍会显示隐藏的字形,如 herehere 所示。

问题

有人能想到解决此错误的方法吗?

谢谢!

【问题讨论】:

  • 当我运行你的代码时,我有预期的行为。我可以隐藏任何行,并且悬停工具仍然适用于其他行。可能是特定于版本的问题
  • 请问您运行的是什么版本的 Bokeh 和 Python?我目前正在运行 WinPython 发行版 3.6.5 和 Bokeh 0.12.15。我知道 Bokeh 有 0.12.16,所以我会尝试升级,看看是否可行。
  • 我主要使用 0.12.10 和 python 2.7;可能是 0.10 到 0.16 之间的回归

标签: python bokeh


【解决方案1】:

Seb 回答了这个问题,这是因为我运行的是 Bokeh v0.12.15 而不是最新的 v0.12.16

我更新了 Bokeh 后,它就像一个魅力。

不运行最新版本的我太傻了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-21
    • 2021-02-06
    • 1970-01-01
    相关资源
    最近更新 更多