☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Associate renderers with a LegendItem but hide them in the Legend

Community Support
Sebastian_Meinhardt
Sebastian_Meinhardt

Hello,

suppose I have some “main” renderers for a set of data and some associated “supporting” renderers, that point out particular features in the data set. Now I want a legend that explains the meaning of the main renderers, but also allows the user to hide all renderers associated with that item. Let’s take this example:

plot = bokeh.plotting.Figure()

plot.line(x=[1,4,5], y=[2,4,2], legend=‘foo’, line_color=‘blue’) # Main renderer for ‘foo’
plot.circle(x=[1,4,5], y=[2,4,2], legend=‘foo’, line_color=‘blue’) # Main renderer for ‘foo’
plot.circle(x=[5], y=[2], legend=‘foo’, line_color=‘red’, line_width=3, size=8) # Supporting renderer for ‘foo’
plot.legend.click_policy=‘hide’

``

Is it possible to not show the big red circle in the actual legend box (because it looks quite ugly), yet have the big-red-circle-renderer be hidden in the plot, when the legend item ‘foo’ is clicked?

⌁   Link to post

End of archived discussion · Replies are disabled