-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[MNT]: Improve backend selection API #26406
Copy link
Copy link
Open
Labels
API: changesChanges to the public API, typically requiring deprecation.Changes to the public API, typically requiring deprecation.API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …Consistency of the matplotlib API, including naming, behavior, defaults, …Maintenance
Milestone
Metadata
Metadata
Assignees
Labels
API: changesChanges to the public API, typically requiring deprecation.Changes to the public API, typically requiring deprecation.API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …Consistency of the matplotlib API, including naming, behavior, defaults, …Maintenance
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
We currently have:
matplotlib.usematplotlib.get_backendpyplot.switch_backendIssues:
matplotlib.useis really obscure.switch_backendanduseis not quite clear.Proposed fix
matplotlib.use(and either discourace or long-term deprecateuse(with a pending deprecation)).useandswitch_backendcan be unified. If not, at least improve the documentation.Side note: The
forceparameter inusecan be dropped.is equivalent to
It should be rare that users want to ignore that changing the backend fails. And if so, they can do it explicitly. We do not need to provide API for that. The only slight complication is that this the default behavior is force=True; i.e. dropping would change the default behavor. But we can address that in the course of "renaming": We simply provide a new function, e.g.
set_backendwith the new behavior.