How to remove legend from the plot?

I make legend like that:

    self.__signal_figure.line(x='x', y='y', source=self.__signal_src[name][1],
                            color=kwargs['color'], legend_label=name)
    self.__signal_figure.legend.location = "top_left"
    self.__signal_figure.legend.click_policy = "hide"

I can remove the plot from the figure, but how i can remove the legend from the figure?

Try setting legend.visible to False.

no, it doesn’t help, i must to remove selected interactive legend.

Do you need to remove it, and then later restore it? My guess is that this is not currently supported. But, some things you can try:

  • setting p.legend.items = []

  • deleting the Legend out of p.renderers

In either case you may also need to try doing something else to trigger a re-render.

1 Like