[bokeh] Associate a renderer with a LegendItem but do not show it in the actual Legend


I don't think this is really going to be possible currently. I think it would require new development, either a generic hook on legend visibility events so that you could execute whatever CustomJS code you wanted (i.e. to mute some other glyphs yourself), or the addition of a specific property on legend item to support this. I'd encourage you to open a GitHub feature request issue.




On Mar 21, 2019, at 7:11 AM, [email protected] wrote:


I have some renderers for a data set, and some supporting renderers that point out particular features in the data. I would like to have a legend, that explains the main renderers, and has a click_policy that hides both, the main and the supporting renderers. 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'

Can I somehow prevent the big red circle to show up in the legend-box, yet be affected by the click_policy? I would like to only have the blue lines and circles be shown next to the label 'foo' in the legend.

You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9ce2af23-14c0-4f29-a4c4-c63482b7a3a7%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.