Can I add a callback to bokeh elements generated by holoviews, and have it work with the holoviews rendering?
I would like to be able to toggle the bokeh renderer visibility with a button like in the code below where I just add a simple js callback to the underlying bokeh figure.
Can I do something similar but with the holoviews rendering itself?
When I am plotting something over background tiles, I’d like to be able to switch the plot visibility on/off so I can see the tile under it. My use case is for a rasterize(hv.quadmesh) object. I am aware of the hook option but don’t know if it can be used for this?
import holoviews as hv
from bokeh.models import Column, Button, CustomJS
from bokeh.io import show
hv.extension('bokeh')
p = hv.Points(range(10000))
fig = hv.render(p)
change_visible = CustomJS(args={"renderer":fig.renderers[0]},code="renderer.visible = !renderer.visible")
b = Button(label="Show/Hide")
b.js_on_click(change_visible)
show(Column(b,fig))