Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Enh new figure function in backends#18852
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The docstring in ManagerBase claims that *num* can be str or int,however ever backend used int-specific formatting so this was notactually true.Fixed the backends rather than fixing the docstring (because settingthe window title on Manager init is useful and implicitly supportedthrough some special-casing in `plt.figure`).
The previous code only sets the title once, on refresh we would fallback to using the result of `fig.get_label()` if in is not the emptystring or f'Figure {num}'.
I think things that could be added:
importmatplotlibasmplnew_figure=mpl.get_me_a_working_figure_factory()fig=new_figure('a label')ax_dict=fig.subplots_mosaic('AA\nBC') |
See also#14024? I think in any case you need to change |
OK, but why can't this be spelled: importmatplotlibasmplfig=mpl.figure()ax_dict=fig.subplots_mosaic('AA\nBC') The user doesn't need to know that this factory is spooled up? I appreciate that makes some global state, but in |
On the default branch linking to a conversation with@jklymak on gitter:https://gitter.im/matplotlib/matplotlib?at=5f9dc6c02a35440715f8e6a3 The lesson I have learned from working on Matplotlib is that global state is a giant headache as is doing GUI integration. I am very 👍 on us keeping the code to do that for the user, but I am not 100% sure we got everything right so am concerned about always calling that code for the user. I think it is important that we maintain a way for people who want to do their own thing to be sure that they will never have to deal with our (likely still buggy) attempts to "do the right thing" have a way to do that (by not importing the module where we act like an application rather than a library). There definitely needs to be a way |
I don't have the bandwidth to push this across the line for 3.4. |
Pushing to 3.6 |
Since this Pull Request has not been updated in 60 days, it has been marked "inactive." This does not mean that it will be closed, though it may be moved to a "Draft" state. This helps maintainers prioritize their reviewing efforts. You can pick the PR back up anytime - please ping us if you need a review or guidance to move the PR forward! If you do not plan on continuing the work, please let us know so that we can either find someone to take the PR over, or close it. |
PR Summary
Code arising out of a discussion on gitter, still needs a bunch of documentation and to sort out if we actually need to track the GUI windows (which I was asserting we did, but am no longer sure that is true).
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).