I created a map roughly following the texas.py example from Bokeh's documentation. I am trying to add a point on the map that has its own mouseover behavior. I've added the glyph with the following:
bc_glyph = Circle(x=barclays_x, y=barclays_y, size=10, line_color="black", fill_color="silver", line_width=1)
I attempted to create custom HoverTool behavior with this:
bc_ht = HoverTool(renderers=['bc_glyph'], tooltips=['Barclays Stadium'])
Then I called plot.add_glyph(bc_glyph)
. When running my script, I get the following output:
ValueError: expected an element of either Auto or List(Instance(Renderer)), got ['bc_glyph']
A quick google of the error message leads to Bryan helping another user with a similar issue, so I rewrite as follows:
plot_add = plot.add_glyph(bc_glyph)
bc_ht = HoverTool(renderers=['plot_add'], tooltips=['Barclays Stadium'])
However, that returns the same error:
ValueError: expected an element of either Auto or List(Instance(Renderer)), got ['plot_add']
I understand I have fed the wrong input to renderers
, but I'm not sure how to correct this. Any help is appreciated.
You are still passing a string, 'plot_add'
, as the value. You need to pass the actual variable:
bc_ht = HoverTool(renderers=[plot_add], # no quote around plot_add
tooltips=['Barclays Stadium'])