bokeh taptool selection colours

牧云@^-^@ 提交于 2021-02-10 17:55:33

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!