Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e293f6d

Browse files
committed
Merge pull request #2683 from JamesMakela/close_long_fig_num
Close a figure with a type long or uuid figure number
2 parents 8c16c61 + 9847852 commit e293f6d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matplotlib/pyplot.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,12 @@ def close(*args):
516516
arg = args[0]
517517
if arg == 'all':
518518
_pylab_helpers.Gcf.destroy_all()
519-
elif isinstance(arg, int):
519+
elif isinstance(arg, six.integer_types):
520520
_pylab_helpers.Gcf.destroy(arg)
521+
elif hasattr(arg, 'int'):
522+
# if we are dealing with a type UUID, we
523+
# can use its integer representation
524+
_pylab_helpers.Gcf.destroy(arg.int)
521525
elif is_string_like(arg):
522526
allLabels = get_figlabels()
523527
if arg in allLabels:

0 commit comments

Comments
 (0)