How to update Holoviews plot's width/height?

Hello everyone, I would like to work in Jupyter Notebook though the project with one plot. Update it with a new data or new layout, maybe add/delete additional plot nearby it and so on… In Bokeh I could use smth similar to:

 target = show(layout, notebook_handle=True)

In Holoviews I found how to feed new data to the existed plot:

pipe = Pipe(data=[])
Image = hv.DynamicMap(hv.Image, streams=[pipe1])
pipe.send(np.random.rand(3,2)) #data change

But is there any solution to manage live layout update? Is it possible to update existed plot by .opts() construction? In this example I will get a new plot:

pipe = Pipe(data=[])
Image = hv.DynamicMap(hv.Image, streams=[pipe])
#######new cell in jupyter notebook############

Do you want to stick to only holoviews or panel can be an option?

with panel you could do that:

import param
import panel as pn
import numpy as np
import holoviews as hv
from holoviews.streams import Pipe
pipe = Pipe(data=[])

class Layout(param.Parameterized):
    colormap = param.ObjectSelector(default='viridis', objects=['viridis', 'fire'])
    width = param.Integer(default=500)
    update_data = param.Action(lambda x: x.param.trigger('update_data'), label='Update data!')
    @param.depends("update_data", watch=True)
    def _update_data(self):

layout = Layout()
Image = hv.DynamicMap(hv.Image, streams=[pipe]).apply.opts(cmap=layout.param.colormap, width=layout.width)
pdmap = pn.panel(Image)
playout = pn.panel(layout)
def update_width(*events):
    for event in events:
        if event.what == "value":
            pdmap.width =, parameter_names=['width'], onlychanged=False)

pn.Row(playout, pdmap)

1 Like

Dear xavArtley, thank you so much for that answer! You’ve just answered more than one question by your post! Lot of thanks!