Adding spans to legend--or hide/show spans


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.