Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hvplot using groupby with active legend is flickering #1369

Open
1 task done
mosc9575 opened this issue Jul 12, 2024 · 1 comment
Open
1 task done

hvplot using groupby with active legend is flickering #1369

mosc9575 opened this issue Jul 12, 2024 · 1 comment
Labels
type: bug Something isn't working

Comments

@mosc9575
Copy link

I am running a hvplot() on a xarray in a Jupyter Notebook in VSCode and the figure is flickering if it has a legend.

flickering_legend

The changing size of the figure with the legend is unwanted and makes is hard to focus on the shown data. To me it looks like the figure is updated twice, once without the legend and then the total available space is used, and a second time with the legend.

If this is right, there is somewhere in the process a unneeded calculation.

All software version info Python, HvPlot, Panel, Bokeh
  1. Python version : 3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)]
  2. IPython version : 8.25.0
  3. Tornado version : 6.4.1
  4. Bokeh version : 3.4.2
  5. BokehJS static path : ~\Envs\fbpinn\Lib\site-packages\bokeh\server\static
  6. node.js version : (not installed)
  7. npm version : (not installed)
  8. jupyter_bokeh version : 4.0.5
  9. hvplot version : 0.10.0
  10. panel version : 1.4.4
  11. Operating system : Windows-10-10.0.19045-SP0

VSCode

  1. Version: 1.91.1 (user setup)
  2. Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729
  3. Date: 2024-07-09T22:06:49.809Z
  4. Electron: 29.4.0
  5. ElectronBuildId: 9728852
  6. Chromium: 122.0.6261.156
  7. Node.js: 20.9.0
  8. V8: 12.2.281.27-electron.0
  9. OS: Windows_NT x64 10.0.19045
import hvplot.xarray  # noqa
import numpy as np
from xarray import Dataset

x = np.arange(-np.pi,np.pi,0.1)
t = np.arange(0,10,0.1)
u = np.array([k*np.sin(x) for k in t]).T
v = np.array([k*np.cos(x) for k in t]).T

ds = Dataset({"u": (["x", "time"], u), "v": (["x", "time"], v)}, coords={"x": x, "time": t})

a = ds[["u", "v"]].hvplot(groupby="time", legend=False).opts(ylim=(-10.2,10.2))
b = ds[["u", "v"]].hvplot(groupby="time").opts(ylim=(-10.2,10.2))

a+b

Comment

I was trying to reproduce this in a browser in JupyterLab and JupyterNotebook but there was no flickering. I don't know why. I guess the update frequency can be different, which could explain the different visual observations.

  • I may be interested in making a pull request to address this
@ahuang11 ahuang11 added the type: bug Something isn't working label Jul 16, 2024
@ahuang11
Copy link
Collaborator

I can reproduce, but not sure why; perhaps something wrong with jupyter-bokeh; maybe you can submit an issue there too https://github.com/bokeh/jupyter_bokeh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants