Skip to content

Commit 06de6d0

Browse files
committed
MNT: Use Gcf.destroy(manager) instead of Gcf.destroy(manager.num)
Going through manager.num is unnecessary as destroy() only looks up the manager for the given number again. As the docstring of destroy() explains: > It is recommended to pass a manager instance, to avoid confusion when two managers share the same number.
1 parent 7d5d027 commit 06de6d0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/matplotlib/_pylab_helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ def destroy(cls, num):
6868
@classmethod
6969
def destroy_fig(cls, fig):
7070
"""Destroy figure *fig*."""
71-
num = next((manager.num for manager in cls.figs.values()
72-
if manager.canvas.figure == fig), None)
73-
if num is not None:
74-
cls.destroy(num)
71+
manager = next((manager for manager in cls.figs.values()
72+
if manager.canvas.figure == fig), None)
73+
if manager is not None:
74+
cls.destroy(manager)
7575

7676
@classmethod
7777
def destroy_all(cls):

lib/matplotlib/text.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ def draw(self, renderer):
796796
mtext = self if len(info) == 1 else None
797797
x = x + posx
798798
y = y + posy
799+
Rectangle((x, y), wh[0], wh[1]).draw(renderer)
799800
if renderer.flipy():
800801
y = canvash - y
801802
clean_line, ismath = self._preprocess_math(line)

0 commit comments

Comments
 (0)