Vertical responsiveness problem holoviews (bokeh) with panel.serve()

My holoviews plot with bokeh backend doesn’t scale responsively in height. The code below gives me a zero-height plot, while I expect it to fill the screen. I believe this used to work.

panel=0.11.3
holoviews=1.14.3
bokeh=2.3.2

import holoviews as hv
import panel as pn

hv.extension('bokeh')

plot = hv.Curve(((0, 1, 2), (4, 4, 7))).opts(responsive=True)
pn.serve(plot)

This is a regression/ bug. Could you post an issue on GitHub?

I believe it’s related to max_width regression · Issue #2253 · holoviz/panel · GitHub

Thanks @Marc for your reply. It looks like it is related indeed. Clicking on referenced issues I found
this one, which is exactly the problem I found. So it seems to be reported already.

1 Like

@Leonidas: check out if something like this could work for you:

plot = hv.Curve(((0, 1, 2), (4, 4, 7))).opts(responsive=True)

responsive_pane = pn.pane.HoloViews(
    plot,
    sizing_mode="stretch_both"
)

display(
    pn.Column(
        responsive_pane,
        background='yellow',
        sizing_mode='stretch_width',
        min_height=600,
    )
)

https://colab.research.google.com/drive/1xn9iizj8d8q7W8IB-q4jRbDZmbwkImxX?usp=sharing

The yellow column is just there to be a fixed size container to let you see the plot fill the whole area. I’ve just researched a similar issue and for me, this approach also worked with servable. I don’t know if there are any official examples of this in the documentation, I’ve found it in a comment somewhere.

Wrapping the plot in a column as you suggest does work with serve! It doesn’t work when I use it within golden layout, though, which is where I need it.

I’ll just stick to fixed height plots until the bokeh bug is fixed.

The fixed height Column was there just as a placeholder to have something for the plot to stretch to. The solution was the pn.pane.HoloViews(plot, sizing_mode="stretch_both") part and it should work exactly the same with any other parent. (I know because I just used it in my project.) If it doesn’t work for you, most probably your parent element is not taller than your plot, so it has no vertical space to stretch to.