问题
I am using the TapTool
in bokeh to select some circles which I have drawn on top of a gmap
. Currently, the selected circle is in the foreground and the rest fade into the map background.
Is there a way to change this default behaviour? I would like, for example, to give a different colour boundary to the selected circle and keep the rest the same. Is there a way to change the rendering of the selected and unselected objects?
回答1:
The Styling Visual Attributes chapter of the User's Guide has a section specifically for Selected and Unselected Glyphs. The easiest way is to use the convenience paramters that can be passed to the glyph methods:
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)
来源:https://stackoverflow.com/questions/58017566/bokeh-taptool-selection-colours