如何配置 TapTool,使其在单击时不隐藏其他数据点?

How can I configure the TapTool so it does not hide other data points when clicked?

在点击一个数据点的那一刻,所有其他数据点都被遮蔽。有什么办法可以避免这种情况吗?

fig = fig.circle(x, y)

理想情况下,我想增加所选圆圈的大小。为什么要这样做?

更新

看来我们不能改变大小...根据here:

Only the visual properties of selection_glyph and nonselection_glyph are considered when renderering. Changing positions, sizes, etc. will have no effect.

但是,我们可以用line_width属性来模拟,如果我把它和line_dish结合起来就更好玩了。

从Bokeh 0.12.15开始,你可以在调用字形方法时简单地设置nonselection_glyph=None,例如:

p.circle(x, y, radius=radii, fill_color="navy", 
         line_color=None, fill_alpha=0.6, 

         # this is the new part
         nonselection_glyph=None) 

旧:

从 Bokeh 0.9.0 开始,使用 bokeh.plotting 界面有点笨拙。您需要将 non_selection_glyph 设置为与 "normal" 字形相同。这是一个基于 Bokeh 附带的 color_scatter.py 示例的完整示例:

import numpy as np

from bokeh.plotting import figure, show, output_file

N = 4000

x = np.random.random(size=N) * 100
y = np.random.random(size=N) * 100
radii = np.random.random(size=N) * 1.5

TOOLS="pan,wheel_zoom,box_zoom,reset,tap,box_select,lasso_select"

output_file("color_scatter.html")

p = figure(tools=TOOLS)
p.circle(x, y, radius=radii, fill_color="navy", 
         line_color=None, fill_alpha=0.6, name="foo") 

# !!! Here is the part you need. Also note: name="foo" added above !!!
renderer = p.select(name="foo")[0]
renderer.nonselection_glyph=renderer.glyph.clone()

show(p)  # open a browser

我已经在 GH 上发了 issue 来改进这个,你可以在这里关注它:

https://github.com/bokeh/bokeh/issues/2414