ea42gh
1
I ended up with the following: hv.Overlay(*h1,*h2)
Is there a better way?
def set_toolbar_autohide(plot, element):
bokeh_plot = plot.state
bokeh_plot.toolbar.autohide = True
def spikes(t,s, dims=["time", "x"], label="Signal", add_curve=False):
hs = hv.Spikes((t,s),*dims, label=label).opts(muted_alpha=0.)
if add_curve: hs = hs + hv.Curve((t,s), label=label).opts(line_width=0.8)
return hs
t = np.linspace(0,5,128)
sig = np.exp(2j*np.pi*(0.5*t)*t)
h= hv.Overlay([
*spikes(t, np.real(sig), label='real', add_curve=True).opts( "Spikes", color='blue'),
*spikes(t, np.imag(sig), label='imag', add_curve=True).opts( "Spikes", color='red')])
pn.Row(
h.opts( title="Signal", height=220, width=400, legend_position='top', toolbar='above', hooks=[set_toolbar_autohide]))
If it wasn’t a layout:
import holoviews as hv
a = hv.Curve([0, 1, 2]) * hv.Curve([4, 5, 6])
b = hv.Curve([0, 1, 2]) * hv.Curve([4, 5, 6])
a * b