ksunden on v3.7.x
Backport PR #25151: Increase ti… Merge pull request #25154 from … (compare)
dstansby on main
Increase timeout to GitHub API Merge pull request #25151 from … (compare)
plt.figure
, and plt.subplots
into matplotlib/__init__.py
and 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.use
so why can't we manage the backend?
plt.figure
we 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.Gcf
class? Are there other hooks to pyplot
in 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 pyplot
they would protect themselves from plt.pcolormesh
figure
, subplots
, and subplots_mosaic
that seems reasonable.
show
is spelt 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
if self
checks in backend_wx and sip.isdeleted(...)
in backend_qt)