如何从散景图中删除工具提示上的箭头

How to remove arrow on tooltip from bokeh plot

有没有办法去除工具提示上的黑色小指针箭头(指示point_policy='follow_mouse'时鼠标的位置)? 任何帮助表示赞赏

您可以将 .show_arrow 设置为 False。在悬停工具上。

从 Bokeh 0.12.2 开始,有以下选项:

hover.show_arrow = False

这是一个完整的例子,取自 official documentation:

#!/usr/bin/env python
# coding: utf-8
#

from bokeh.plotting import figure, output_file, show
from bokeh.models import HoverTool


def main():
    # prepare some data
    x = [1, 2, 3, 4, 5]
    y = [6, 7, 2, 4, 5]

    # output to static HTML file
    output_file("lines.html")

    # create a new plot with a title and axis labels
    p = figure(title="simple line example", x_axis_label='x', y_axis_label='y', tools='hover')

    # add a line renderer with legend and line thickness
    p.line(x, y, legend="Temp.", line_width=2)

    # hover
    hover = p.select_one(HoverTool)
    hover.point_policy = "follow_mouse"
    hover.tooltips = [
        ("Name", "@name"),
        ("Unemployment rate)", "@rate%"),
        ("(Long, Lat)", "($x, $y)"),
    ]
    # disable tooltip arrow
    hover.show_arrow = False

    # show the results
    show(p)

    return 0

if __name__ == '__main__':
    exit(main())

(历史记录)

正如 bigreddot 所说,我打开了一个 issue and I made a patch 来禁用箭头。如果接受,您将能够禁用箭头:

hover.show_arrow = False