-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: Custom backend stopped working in 3.6.2 #24524
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
Trying older versions of Matplotlib, the problem first appears in 3.6.0. |
As noted by the leading underscore, _Backend has never been intended to be a mechanism for the implementation of third-party backends. The API to implement backends prior to matplotlib 3.6 was documented (somewhat poorly, admittedly) in https://matplotlib.org/stable/api/backend_template_api.html; in matplotlib 3.6 this API has been streamlined and there is a PR to describe the new API at #24218; see https://output.circle-artifacts.com/output/job/77219d62-0e62-45c1-9e6b-c3ec83e68401/artifacts/0/doc/build/html/users/explain/writing_a_backend_pyplot_interface.html for the rendered docs. |
Is there a minimal working example of a backend that would work with 3.6.0 and up? |
matplotlib/backends/backend_template.py is intended as such an example, although I can see it's not entirely up to date... |
Actually the breakage did show a bug in the new backend API implementation; #24527 should fix that (and it also updates the backend_template example). |
If I replace
I still get
Is that the breakage that #24527 is supposed to fix? Or am I doing something wrong? |
If I remove |
Looking at it again, the problem in your case is different from the one fixed by #24527. Rather, in order to register the manager class, setting class MyCanvas(FigureCanvasAgg):
manager_class = MyFigureManager (this is assuming you don't want to use the old, old method of defining new_figure_manager and related functions). |
Ah, victory! That works. Thanks a lot for your help. |
@jklymak It's probably too strong to call what I did a custom backend. I just call |
Bug summary
A custom backend that's been working for a few years without a problem, stopped working under Matplotlib 3.6.2.
Code for reproduction
Actual outcome
Running using Matplotlib 3.5.3, this outputs:
But running using 3.6.2, I get:
In particular,
MyFigureManager.show()
is never called.Expected outcome
Same behavior under both versions.
Operating system
macOS
Matplotlib Version
3.5.3, 3.6.2
Python version
3.10.8
The text was updated successfully, but these errors were encountered: