-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
webAgg example broken - maybe mpl.js broken? #19129
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
Comments
This is also broken as of v3.3.3, but I'm sure I tested this then due to backporting fixes for older Firefox. I wonder if this was a change in Firefox that broke it. |
In chrome derivative on 3.3.3 I get a slightly better error:
I also manually tested this in prep of 3.3.3 . Could the problem be on the other side and someting changed in tornado's websockets? |
This bisects to #18361, which sends the pixel ratio message earlier (in |
🐑 |
I did just verify that nbagg still works on v3.3.3 so that is good at least. Presumably we go through a slightly different song/dance to stand the js side figure up in the two cases? |
Yes, nbagg uses a proxy to a WebSocket from ipykernel, which I assume is already stood up before we get it. |
I (independently) found and fixed this bug in the onopen() manner suggested above, so the fix is corroborated. This was in matplotlib 3.3.3 vs recent Firefox. Just to be explicitly clear, what I am saying is: Ttriggering the call to mpl.figure() (in all_figures*.html or single_figure*.html) via websocket.onopen() works. (see https://discourse.matplotlib.org/t/webagg-backend-js-bug-websocket-not-ready/21796) Looking at 30a900f which closed this problem it seems the fix was to not send pixelratio. However, that would not seem to me to address the root cause. The fact is that neither mpl.figure(), nor anything else, should use the websocket before it is open. As written, the possibility remains open that any future changes to mpl.figure() initialization will cause the issue to happen again. I believe the correct solution is to not initialize mpl.figure() until the socket is in fact ready -- or otherwise cause mpl.figure() to refrain from socket operations until we're sure it is open. The link above shows how I avoided the issue by calling mpl.figure() (in all_figures*.html) from websocket.onopen(). However, it did not occur to me that I may then have overriden the original onopen() behavior of that websocket. Possibly I need to also call the prior onopen()? |
I suggest you open a pull request so we can review the change better. |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Extracting the extra bug discovered in #19116 (comment)
Bug summary
The code in https://matplotlib.org/devdocs/gallery/user_interfaces/embedding_webagg_sgskip.html does not display anything in the browser when running master matplotlib (27aaf0c)
Code for reproduction
Actual outcome
No plot + this DOM exception in the JS console:
Expected outcome
A working interactive plot shows up
Matplotlib version
print(matplotlib.get_backend())
): webAggInstalled python from conda-forge:
The text was updated successfully, but these errors were encountered: