☰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

Adding spans to legend--or hide/show spans

Community Support
jgriffi6
jgriffi6

Hi,

thanks to this:

I can easily make my legend interactive. However, if I want to hide/show my spans, I cannot do so–at least not from the legend. So is it possible to add a span to a legend?

Legend(items=(‘my span’, [Span(…), Span(…)]))

It appears this is not allowed since Span, unlike Line or Ray is not a GlyphRenderer object. As a not fully satisfactory solution, I can use an ‘infinite’ ray. However the ray is not truly infinite, and sometimes disappears while panning up and down the plot. Note I set the ray length to 0.

It seems natural to me to be able to add a span to a legend.

Thanks,

Justin

⌁   Link to post

End of archived discussion · Replies are disabled