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

Skip to content

Commit 95c7b70

Browse files
committed
Let pyplot users find out if a figure number exists, or list fignums.
svn path=/trunk/matplotlib/; revision=6966
1 parent d2dffee commit 95c7b70

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2009-03-07 Add pyplot access to figure number list - EF
2+
13
2009-02-28 hashing of FontProperties accounts current rcParams - JJL
24

35
2009-02-28 Prevent double-rendering of shared axis in twinx, twiny - EF

doc/api/api_changes.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ list may help describe what changes may be necessary in your code.
1919

2020
Changes for 0.98.x
2121
==================
22-
* Removed numerix package.
22+
* Added new :func:`matplotlib.pyplot.fignum_exists` and
23+
:func:`matplotlib.pyplot.get_fignums`; they merely expose
24+
information that had been hidden in :mod:`matplotlib._pylab_helpers`.
25+
26+
* Deprecated numerix package.
2327

2428
* Added new :func:`matplotlib.image.imsave` and exposed it to the
2529
:mod:`matplotlib.pyplot` interface.
@@ -46,7 +50,7 @@ Changes for 0.98.x
4650
================ ================
4751

4852

49-
* Removed the configobj and experiemtnal traits rc support
53+
* Removed the configobj and experimental traits rc support
5054

5155
* Modified :func:`matplotlib.mlab.psd`, :func:`matplotlib.mlab.csd`,
5256
:func:`matplotlib.mlab.cohere`, and :func:`matplotlib.mlab.specgram`

lib/matplotlib/pyplot.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,14 @@ def gcf():
273273
else:
274274
return figure()
275275

276+
fignum_exists = _pylab_helpers.Gcf.has_fignum
277+
278+
def get_fignums():
279+
"Return a list of existing figure numbers."
280+
fignums = _pylab_helpers.Gcf.figs.keys()
281+
fignums.sort()
282+
return fignums
283+
276284
def get_current_fig_manager():
277285
figManager = _pylab_helpers.Gcf.get_active()
278286
if figManager is None:

0 commit comments

Comments
 (0)