补丁的悬停工具是否与其他图形不同?图中可以看到圆圈的索引,但看不到补丁的索引。
output_file("patch.html")
TOOLTIPS = [
("index", "$index"),
]
p = figure(plot_width=400, plot_height=400, tooltips=TOOLTIPS, tools='hover,help')
# add a patch renderer with an alpha an line width
p.patch([1, 2, 3, 4, 5], [6, 7, 8, 7, 3], alpha=0.5, line_width=2)
p.circle([2], [4],size=20, line_width=2)
show(p)


发布于 2018-11-20 00:06:56
在Bokeh 1.0.2中,尚未为修补程序实现命中测试,也就是说,就Hover工具而言,它是不可见的。您可以使用矢量化的patches字形方法:
p.patches([[1, 2, 3, 4, 5]], [[6, 7, 8, 7, 3]], alpha=0.5, line_width=2)但是,这始终只返回0作为$index的值,因为只有一个补丁(其索引为0)。如果您希望为修补程序的顶点获取“索引”值,则需要在与顶点相同的位置执行一些类似于图的不可见圆的操作,这些圆圈仅用于命中测试目的(以驱动悬停工具)。
https://stackoverflow.com/questions/53383908
复制相似问题