我正在bokeh中使用TapTool
来选择我在gmap
上方绘制的一些圆圈。当前,选定的圆圈在前景中,其余的淡入地图背景。
是否可以更改此默认行为?例如,我想给选定的圆赋予不同的颜色边界,并使其余颜色保持不变。有没有一种方法可以更改选定对象和未选定对象的渲染?
答案 0 :(得分:2)
《用户指南》的Styling Visual Attributes一章专门针对Selected and Unselected Glyphs。最简单的方法是使用可以传递给字形方法的便捷参数:
plot.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=50,
# set visual properties for selected glyphs
selection_color="firebrick",
# set visual properties for non-selected glyphs
nonselection_fill_alpha=0.2,
nonselection_fill_color="blue",
nonselection_line_color="firebrick",
nonselection_line_alpha=1.0)