Dynamically add/remove plots to a pn.Column(hv.Layout)

Hi,
Would it be possible to have a dynamic plot layout (like this) using a hv.Layout wrapped in a pn.Column?
For example: how can I remove one of the following plots from “a” and replace it with a new one?
The pop and append methods used in the panel example are not available in Layout objects.
I use a layout to keep the alignment between plots.

xs = [0.1* i for i in range(100)]

curve_list   = [hv.Curve((xs, [np.sin(f*x) for x in xs])) for f in [0.5, 0.75]]
scatter_list = [hv.Scatter((xs[::5], f*np.linspace(0,1,20))) for f in [-0.5, 0.5]]

layout = hv.Layout(curve_list + scatter_list).cols(1)
a=pn.Column(layout)

The trick is to use pn.pane.HoloVIews and not hv.Layout:

timeseries_LFP = pn.Column(Controls_viewer_.controls,pn.pane.HoloViews(hv.DynamicMap(LFP_viewer_.raster_ripples).opts(framewise=True)), 
          pn.pane.HoloViews(hv.DynamicMap(LFP_viewer_.mouse_state).opts(opts.Rectangles(framewise=True))), 
          pn.pane.HoloViews(hv.DynamicMap(LFP_viewer_.lfp_view).opts(framewise=True)),
          pn.pane.HoloViews(hv.DynamicMap(LFP_viewer_.filtered_view, label="filtered").opts(framewise=True)))

Now it is possible to use the pop and append metods on the variable timeseries_LFP.

1 Like