Fill_alpha when a selection is active cannot be zero

Hi

I have a server-side callback that sets fill_alpha to zero to hide polygons not in the selected area but all polygons from all layers seem to be being forced to a low fill_alpha value (maybe 0.2 or so). I suspect this may be some artifact of the selection highlighting mechanism but in my code literally every fill_alpha value I am using is 0 but as soon as I select a polygon all the layers (renderers) of polygons go visible.

As soon as I deselect then everything goes back to hidden. I am trying to show some maps highlighting the selected area and having all other areas clear.

MY workaround is to kill the selection ``datasource.selection.indices = ``` and ignore the change event that triggers. Just wondering if there is anything else that can be done.

A GlyphRenderer coordinates several versions of the glyph:

  • a “normal” glyph
  • a non_selected glyph
  • (optionally) a selected glyph
  • (optionally) a hover glyph glyph
  • a decimation glyph for during UI events

Presumably you are setting the alpha on just the normal glyph, but when there is a selection active, the normal glyph is not used. The non_selection glyph is what dictates the appearance for all the unselected points whenever there is a selection is active (that is its purpose), and its default alpha is 0.2. You can see how to change the values of the selected/non-selected glyphs here:

https://docs.bokeh.org/en/latest/docs/user_guide/styling.html#selected-and-unselected-glyphs

1 Like