holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.78k stars 518 forks source link

Time slider not working during certain panel use cases #5188

Open Michael-Barletta opened 1 year ago

Michael-Barletta commented 1 year ago

ALL software version info

bokeh 3.1.1 holoviews 1.16.2 geoviews 1.10.0 panel 1.1.1 jupyterlab 4.0.2

Description of expected behavior and the observed behavior

When I use panel dropdowns to select variables and update a geoviews plot using example data, the time slider fails to pop up even though it is being specificized when creating the geoviews dataset. When I just plot the data without going through the steps of selecting variables from my panel app, the time slider works and is visible without issue.

Complete, minimal, self-contained example code that reproduces the issue

(https://github.com/Michael-Barletta/holoviz_examples/blob/main/time_slider_issue.ipynb)

@Hoxbro gave a workaround to wrap the output in pn.panel()

            a = (gv.tile_sources.OSM().opts(frame_width=700, frame_height=400)  * (QM_raster.opts(tools=['hover'], axiswise=True, cmap='coolwarm', colorbar=True, clim=(-30,30))))
            return pn.panel(a)
hoxbro commented 1 year ago

A MRE here:

import hvplot.xarray  # noqa
import panel as pn
import xarray as xr

def update_map(quadmesh):
    if quadmesh:
        return data.hvplot.quadmesh()  # Wrapping this with `pn.panel` works
    return data.isel(time=0).hvplot.quadmesh()

data = xr.tutorial.load_dataset("air_temperature")
checkbox = pn.widgets.Checkbox(value=True, name="show_quadmesh")
pn.Column(checkbox, pn.bind(update_map, checkbox)).servable()

https://github.com/holoviz/panel/assets/19758978/e513119a-7f6f-429c-8cc1-f8b4a5700fdc