Update HoverTool renderers?

On widget action (e.g. on_change() for a RadioGroup), I set certain glyph renderers in my plot to visible=False. This will remove the renderer my HoverTool was assigned to, and I would like to also update the glyph renderer for the HoverTool to a different renderer that is still visible. Is this possible?

For example, I add the HoverTool when first building my figure (f) as:

  f.add_tools(HoverTool(
      renderers=[GlyphRenderer_1],
      tooltips=tooltips,
      line_policy='nearest',
      mode='vline'
      )
  )

It would be great if in my callback for the RadioGroup action I could grab hold of the HoverTool within the figure object and update the renderers.

hold of the HoverTool within the figure object

You can certainly do that with plot.select(...) but personally I would just give the hover tool a name (i.e. assign it to a variable), and they you can just refer to it directly in the callback.

@Bryan this worked great, just assigning a global variable name to the hover tool, and then grabbing it from within callbacks. Thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.