Save a holomap with panel does not work

When I have a (static) HoloMap object like from the docs:

import statements
import holoviews as hv
import panel as pn
import numpy as np
hv.extension('plotly')
pn.extension()
def sine_curve(phase, freq):
    xvals = [0.1* i for i in range(100)]
    return hv.Curve((xvals, [np.sin(phase+freq*x) for x in xvals]))

frequencies = [0.5, 0.75, 1.0, 1.25]
curve_dict = {f:sine_curve(0,f) for f in frequencies}
hmap = hv.HoloMap(curve_dict, kdims='frequency')

I can save it nicely into a static html with:

hv.save(hmap, "hv_test.html")

which works like a charm.


But I cannot save that HoloMap with panel.save(...), when it is embedded into a panel layout like this:

app = pn.Column("Does this work?", hmap)
app.save("pn_test.html")

The resulting slider does not trigger any plot updates.
Is that a bug or am I missing something?

Hi @fmfreeze,

Interaction often requires a server running, the callback in python requires the server hence why the output does not work in this case I think. It is possible to at least from bokeh as I understand to listen for changes via JavaScript and write the callback in JavaScript so that a server isn’t required maybe possible with panel and co but I haven’t done this.

Maybe something like this can help here: panel-sharing/docs/user-guide.md at main · awesome-panel/panel-sharing · GitHub

From the Panel docs a far more informative read than my explanation Export Apps — Panel v1.1.1

Hope of some help

1 Like

Thx @carl, for your input.

The solution is quite simple:

app.save("pn_test.html", embed=True)

embeds widget states and - for the holomap example - their corresponding bokeh plots.

1 Like