I have an overlay figure using hvplots and would like to turn all tools off by default. I know that when you have a figure handle, this could be done as described here, using plot.toolbar.active_drag = None
. However, when trying to use this approach on a Ndoverlay
object, I get the error 'NdOverlay' object has no attribute 'toolbar'
. I also tried to add the overlay to an empty holoview figure with fig.add_layout
and fig.add_glyphs
, but this didn't work either. How can I achieve the desired behavior?
MWE:
import numpy as np
import holoviews as hv
hv.extension('bokeh')
points = [(0.1*i, np.sin(0.1*i)) for i in range(100)]
overlay =hv.NdOverlay({interp: hv.Curve(points[::8]).opts(interpolation=interp, width=600)
for interp in ['linear', 'steps-mid', 'steps-pre', 'steps-post']})
overlay
I found a way to do it based on the answers to this question, by rendering it as a bokeh figure.
import numpy as np
import holoviews as hv
from bokeh.plotting import show
hv.extension('bokeh')
points = [(0.1*i, np.sin(0.1*i)) for i in range(100)]
overlay =hv.NdOverlay({interp: hv.Curve(points[::8]).opts(interpolation=interp, width=600)
for interp in ['linear', 'steps-mid', 'steps-pre', 'steps-post']})
plot = hv.render(overlay, backend='bokeh')
plot.toolbar.active_drag = None
show(plot)