Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9847852

Browse filesBrowse files
committed
Allow closing a figure by long ID number.
Creating a figure with a type(long) figure number is allowed, so closing should be similarly allowed. close figure with type UUID as figure number if we can create a figure with a number that is type UUID, then it is reasonable to be able to close the figure with it as well. make the allowed int types Python 2 and 3 compatible
1 parent 2d051f2 commit 9847852
Copy full SHA for 9847852

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+5-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.