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

Skip to content

Commit fa53aa3

Browse files
committed
Avoid repeatedly warning about too many figures open.
Warning once is useful, but no need to warn again if the user further creates even more figure later in their code (see e.g. tutorials/intermediate/constrainedlayout_guide.py which spams the terminal with such warnings). (Yes, the warning would still get reemitted if the user closes some windows and then goes again above the limit -- that's less of an issue and not really worth working around IMO.)
1 parent 69cd8bf commit fa53aa3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def figure(num=None, # autoincrement if None, else integer from 1-N
503503
if figManager is None:
504504
max_open_warning = rcParams['figure.max_open_warning']
505505

506-
if len(allnums) >= max_open_warning >= 1:
506+
if len(allnums) == max_open_warning >= 1:
507507
cbook._warn_external(
508508
"More than %d figures have been opened. Figures "
509509
"created through the pyplot interface "

0 commit comments

Comments
 (0)