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

[BUG] Matplotlib chart does not show on Firefox #8

Open
joelostblom opened this issue Feb 28, 2024 · 3 comments
Open

[BUG] Matplotlib chart does not show on Firefox #8

joelostblom opened this issue Feb 28, 2024 · 3 comments
Labels
p: medium Address issue before the next release if possible s: confirmed Issue was confirmed to exist t: bug Something isn't working

Comments

@joelostblom
Copy link

On the demo site https://quarto.thecoatlessprofessor.com/pyodide/qpyodide-code-cell-demo.html, I can't get the matplotlib chart to show on Firefox (it shows fine in Chromium). This is for Firefox 123.0 on Linux with all addons disabled:

image

@coatless
Copy link
Collaborator

So, I can re-create it in firefox. Though, clicking on the graph seems to resolve the image display:

quarto-pyodide-graphing-hiccup

I'll probably switch it over to using a static SVG output as the matplotlib backend for pyodide (matplotlib-pyodide) is missing a maintainer.

@coatless coatless added t: bug Something isn't working s: confirmed Issue was confirmed to exist p: medium Address issue before the next release if possible labels Mar 1, 2024
@juanfcocontreras
Copy link

Is there any right now to use another renderer? I tried to change the line matplotlib.use("module://matplotlib_pyodide.html5_canvas_backend") to matplotlib.use("module://matplotlib_pyodide.wasm_backend") in the qpyodide-document-engine-initialization.js file but it still uses the html5 backend.

The problem I have is that I have a couple of graphs with a lot of dots, and the browser freezes. Even a static backend (generating an image instead of html) will solve my problem. It would be possible?

@coatless
Copy link
Collaborator

@juanfcocontreras unfortunately, there isn't a quick way to change renderers. I'll set aside some time soon to address it.

The short gist is we're creating and populating a figure element here:

// Generate a new canvas element, avoid attaching until the end
let graphFigure = document.createElement("figure");
document.pyodideMplTarget = graphFigure;

Under the matplotlib.use("module://matplotlib_pyodide.html5_canvas_backend") backened, this is fine. However, the matplotlib.use("module://matplotlib_pyodide.wasm_backend") may not respect the document.pyodideMplTarget variable we're assigning the graph into. Thus, the graph becomes disassociated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: medium Address issue before the next release if possible s: confirmed Issue was confirmed to exist t: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants