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

Matplotlib with interactive mode creates empty figure #6415

Closed
1 task
anton-br opened this issue Feb 29, 2024 · 0 comments
Closed
1 task

Matplotlib with interactive mode creates empty figure #6415

anton-br opened this issue Feb 29, 2024 · 0 comments
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@anton-br
Copy link

anton-br commented Feb 29, 2024

ALL software version info General:
Ubuntu 22.04.2 LTS
python 3.11.3

library versions:
bokeh==3.3.4
ipympl==0.9.3
ipykernel==6.29.3
ipyleaflet==0.18.2
ipympl==0.9.3
ipython==8.22.1
ipython_genutils==0.2.0
ipywidgets==8.1.2
ipywidgets-bokeh==1.5.0
jupyterlab==4.1.2
jupyterlab_pygments==0.3.0
jupyterlab_server==2.25.3
jupyterlab_widgets==3.0.10
matplotlib==3.8.3
panel==1.3.8

browser:
Chrome 122.0.6261.94

I am trying to reproduce tutorials from here. Everything works fine untill Using the interactive Matplotlib backend section.
Either in jupyter lab or by panel serve I'm receiving the same result: text - Figure with small part of the toolbar.

If summarize, code is the following:

import numpy as np
import panel as pn

pn.extension('ipywidgets')
from matplotlib.figure import Figure

fig = Figure(figsize=(8, 6))
ax = fig.add_subplot(111)

dx, dy = 0.05, 0.05

# generate 2 2d grids for the x & y bounds
y, x = np.mgrid[slice(1, 5 + dy, dy),
                slice(1, 5 + dx, dx)]

z = np.sin(x)**10 + np.cos(10 + y*x) * np.cos(x)

cf = ax.contourf(x + dx/2., y + dy/2., z)
fig.colorbar(cf, ax=ax)

pn.pane.Matplotlib(fig, interactive=True, dpi=72)

My output:

JupyterLab:
image
When hovering the mouse over the Figure text:
image

Same if start with panel serve (I've only added .servable() to pn.pane.Matplotlib to make it work):
image

Acually, in the tutorials we can see the same output right now:
image

Console output

In bash:
image

In browser:
image

Some elements of ipywidgets_bokeh are not found. However, googling the error gives no result.

I've tried to add pn.extension(sizing_mode="stretch_width") as was mentioned here but it did not work.

  • I may be interested in making a pull request to address this
@philippjfr philippjfr added this to the v1.4.0 milestone Mar 11, 2024
@philippjfr philippjfr added the type: bug Something isn't correct or isn't working label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

2 participants