rcomer on main
DOC: cleanup constrained layout… Merge pull request #25144 from … (compare)
Cadairwhich is maybe another simplifying assumption that we can get away with that mpl core wouldn't be abel to
matplotlib/__init__.pyand then ask people to not do
import matplotlib.pyplot as plt. That will instantly raise if they accidentally cut-and-paste some pyplot code in.
fig = mpl.figure.Figure(); ax = fig.subplots()and get a figure fully managed by you (we hold no references to it)
mpl.useso why can't we manage the backend?
plt.figurewe are creating a Figure, a canvas (of the correct GUI class), a manager, a window, a toolbar, and registering the manger with our global registry of open figures
_pylab_helper.Gcfclass? Are there other hooks to
pyplotin there? I'm certainly not saying get rid of pyplot, so if someone did import pyplot and do
plt.gcf()that should be fine and could raise the last created figure. But if they didn't import
pyplotthey would protect themselves from
subplots_mosaicthat seems reasonable.
plt.show([fig1, fig2, ...])(for example) (I think I have a PR enabling that somewhere...)
plt.show()magically pops up all figures, that doesn't mean that we have to have a notion of current figure