-
Notifications
You must be signed in to change notification settings - Fork 10
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 3.8.4 update: restore WASM backend and partially restore HTML5 Canvas backend #64
Matplotlib 3.8.4 update: restore WASM backend and partially restore HTML5 Canvas backend #64
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Looks like matplotlib is complaining about the type of capstyle. Using enums may work.
|
4ed8bfc
to
09abbb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks!
Still not fully fixed yet! |
toolbar
before initialising
Bumping to Chrome 131 here did not fix the previous issues, so I guess we'll tackle it later, it's not strictly necessary. I'll patch Matplotlib once again with these changes in pyodide/pyodide#4510 and see if everything is working – if yes, we can merge this safely. |
4d7f409
to
4c685d9
Compare
Co-Authored-By: Gyeongjae Choi <[email protected]>
81947d9
to
fd6389b
Compare
for more information, see https://pre-commit.ci
Thanks for the review, @ryanking13! I'd like to keep the HTML5 backend updates I made here and not completely remove them so that either I or someone else can return to them at some point and fill in the missing piece that is required to make them work. Since you've already approved these changes in the PR, I shall merge it now – but if you feel otherwise about anything, please let me know! |
Thanks so much for working on this @agriyakhetarpal! |
First thank you all very much for such an amazing project! One thing I would like to bring to your attention is the change introduced at 0.27.0 of backend approach really breaks backend like FigureCanvasSVG. This is what we get when we try: "UserWarning: FigureCanvasSVG is non-interactive, and thus cannot be shown". Prior to this update, to implement/extend a backend was simple and versatile, which basically override FigureManager show() method, say, to simply print out some information. Can we at least have a mechanism to make this non-interactive optional, or allow a custom backend implementation to return a simple flag to comply with whatever requirement (in this case, pretend to be interactive, thus show() will be called upon). Currently, we are unable to upgrade to 0.27.0 because of this. Again, thanks! |
Thanks for the report @jsclass42, sadly, we are lacking human resources to manage two different backends and we are trying to find a way to support matplotlib-pyodide in a long term (#65). Meanwhile, you can try to patch matplotlib-pyodide, make your own backend and accomplish what you need. |
Yes, agree with Gyeongjae – I would be grateful if you could fully restore the previous behaviour and find out what's missing for the backend(s) to work as they did earlier. If we're able to, we can easily get a new release here and include it with Pyodide 0.27.1/0.27.2. |
Thank you @ryanking13 for your reply and suggestion! I decided to look into the codes, including the matplotlib/backend_bases.py, and it turns out the break on my end had nothing to do with pyodide or matplotlib-pyodide. If it helps anyone: if you are running into problem like '... in non-interactive, and thus cannot be shown', the warning comes from the base FigureManagerBase .show() method, if you extend the class and not override the show() method Again, thanks! |
This PR has been put together towards a resolution for pyodide/pyodide#4510, which aims to update the Matplotlib version for Pyodide in-tree from 3.5.2 to 3.8.4, and is the next step towards releasing
matplotlib-pyodide
version 0.2.3 – please see #60 for tracking the release. It restores the WASM backend to work with Matplotlib 3.8.4 and partially restores the HTML5 Canvas backend—an attempt was made to get it to work, but I did not see through it entirely—by internally redirecting it to use the WASM backend for rendering.A complete restoration of the HTML5 backend or a reorganisation of the backends to a maintained or working state can be looked at later with a new matplotlib-pyodide release and a corresponding Pyodide release, and contributions towards this are very much welcome. Please see #65 for further discussions and additional context.
Specifically, the changes here are as follows:
setuptools
-specific) have been git-ignoredMathTextParser
, since the bitmap-based one was deprecated in Matplotlib 3.4 and removed around 3.6. It is able to create and parse glyphs and draw them on the screen, but fonts are currently missing when drawn.