holoviz / holoviz/hvplot

Issue with responsive plots using image

Open
#1,074 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

Generating a responsive plot with `image` appears to not work since panel was updated to version 1.0.0. I'm aiming to open a plot in my web browser, which will responsively fill the screen. However, the update to panel (and also the change in the dependent version of bokeh) seems to have broken the ability of `image` to do this.

I'm working on Fedora 33, and the issue was initially raised to me by someone using my nctoolkit package on macOS M1.

The code below should reproduce the problem on all 1.0.x versions of panel. Instead of filling the web browser the plot gets squashed.

```
import xarray as xr
from threading import Thread
import hvplot.xarray
import hvplot as hv
import panel as pn
from bokeh.plotting import show

import hvplot.xarray

hv.extension("bokeh")
hv.Store.renderers

import nctoolkit as nc

ds = xr.tutorial.open_dataset('air_temperature').load()

def ctrc():
"""
A basic control to send a message to the terminal
"""
print("Press Ctrl+C to stop plotting server")

intplot = ds.hvplot.image("lon", "lat", "air",
dynamic = True,
rasterize = False,
responsive = True
)

t = Thread(target=ctrc)
t.start()
bokeh_server = pn.panel(intplot, sizing_mode="stretch_both").show(
threaded=False
)

```

If I run this using the latest version of panel I get a squashed plot that cannot be read.

![hvplot](https://github.com/holoviz/hvplot/assets/14128389/04201484-580f-48f6-ab10-f56a237b1899)

However, it is fine in panel version 0.14.4.

![panel014](https://github.com/holoviz/hvplot/assets/14128389/728e072d-46d6-4aa1-9b25-2a5417a04636)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.