Layout behavior of holoviews in a panel

I am getting this problem (see the plots at the bottom) when I run the script below
holoviews version 1.19.1
panel version 1.5.2

# %%
import numpy as np
import pandas as pd
import hvplot.pandas
import holoviews as hv
from holoviews import opts, dim, streams

hv.extension("bokeh")
# %%
# create a time series of a sinusoidal wave
n = 100
step = 0.1
time = pd.date_range("2020-01-01", periods=n / step, freq="h")
amplitude = np.sin(np.arange(0, n, 0.1))
dfsine = pd.DataFrame({"time": time, "amplitude": amplitude})
amplitude = np.cos(np.arange(0, n, 0.1))
dfcosine = pd.DataFrame({"time": time, "amplitude": amplitude})
# %%
tsplot = dfcosine.hvplot(x="time") * dfsine.hvplot(x="time")
tsplot = tsplot.opts(opts.Curve(height=300, width=500))
# %%
kdeplot = dfcosine.hvplot.kde(y="amplitude") * dfsine.hvplot.kde(y="amplitude")
kdeplot = kdeplot.opts(shared_axes=False).opts(opts.Distribution(height=200, width=300))
kkplot = kdeplot + kdeplot
# %%
import panel as pn

pn.extension()
# %%
pn.Row(pn.Column(pn.Row(tsplot), pn.Row(kkplot)))
# %%
pn.Row(pn.Row(pn.Column(pn.Row(tsplot), pn.Row(kkplot))))
# %%

The output from the last two cells is

and

Any idea whats going on here?

I tried .redim.label and setting linked_axes=False to no avail.

However, I noticed if you removed Panel completely, it works!

So I slowly started removing panel calls, and found out nested Row calls caused the issue:

# %%
import numpy as np
import pandas as pd
import hvplot.pandas
import holoviews as hv
from holoviews import opts, dim, streams

hv.extension("bokeh")
# %%
# create a time series of a sinusoidal wave
n = 100
step = 0.1
time = pd.date_range("2020-01-01", periods=n / step, freq="h")
amplitude = np.sin(np.arange(0, n, 0.1))
dfsine = pd.DataFrame({"time": time, "amplitude": amplitude})
amplitude = np.cos(np.arange(0, n, 0.1))
dfcosine = pd.DataFrame({"time": time, "amplitude": amplitude})
# %%
tsplot = dfcosine.hvplot(x="time") * dfsine.hvplot(x="time")
tsplot = tsplot.opts(opts.Curve(height=300, width=500))
# %%
kdeplot = dfcosine.hvplot.kde(y="amplitude") * dfsine.hvplot.kde(y="amplitude")
kdeplot = kdeplot.opts(shared_axes=False).opts(opts.Distribution(height=200, width=300))
kkplot = kdeplot + kdeplot
# %%
import panel as pn
pn.Row(pn.Column(pn.Row(tsplot), pn.Row(kkplot))).show()
# %%

If you drop one layer of Row it should show as expected; not sure why.

@ahuang11 Thanks for the investigation. However I can’t be sure that the user will not embed inside another UI pane. That’s where it’s causing this issue

Also doesn’t happens if I have only a holoviews overlay but only if I have a holoviews overlay and holoviews layout together within the same layout !!

Would like to know if I should open this as a panel bug or holoviews bug ?

Looks like it is the same issue here

Infact if in the github issue if the holoviews layout is replaced with a holoviews plot it is fine. Continuing discussion there