8000 Add .number attribute to figure objects returned by figure() - FP · matplotlib/matplotlib@cbfd30f · GitHub
[go: up one dir, main page]

Skip to content

Commit cbfd30f

Browse files
committed
Add .number attribute to figure objects returned by figure() - FP
svn path=/trunk/matplotlib/; revision=1088
1 parent 1dbba28 commit cbfd30f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
New entries should be added at the top
2+
2005-03-18 Add .number attribute to figure objects returned by figure() - FP
3+
24
2005-03-16 Fixed labelsep bug
35

46
2005-03-16 Applied Darren's ticker fix for small ranges - JDH

lib/matplotlib/pylab.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -724,10 +724,9 @@ def figure(num=None, # autoincrement if None, else integer from 1-N
724724
figure(num = None, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k')
725725
726726
727-
Create a new figure and return a handle to it. If num=None, the
728-
figure number will be incremented and a new figure will be
729-
created.
730-
727+
Create a new figure and return a handle to it. If num=None, the figure
728+
number will be incremented and a new figure will be created. The returned
729+
figure objects have a .number attribute holding this number.
731730
732731
If num is an integer, and figure(num) already exists, make it
733732
active and return the handle to it. If figure(num) does not exist
@@ -744,7 +743,6 @@ def figure(num=None, # autoincrement if None, else integer from 1-N
744743
edgecolor - the border color; defaults to rc figure.edgecolor
745744
746745
rcParams gives the default values from the .matplotlibrc file
747-
748746
"""
749747

750748
if figsize is None : figsize = rcParams['figure.figsize']
@@ -764,7 +762,8 @@ def figure(num=None, # autoincrement if None, else integer from 1-N
764762
if get_backend()=='PS': dpi = 72
765763
figManager = new_figure_manager(num, figsize, dpi, facecolor, edgecolor, frameon)
766764
_pylab_helpers.Gcf.set_active(figManager)
767-
765+
figManager.canvas.figure.number = num
766+
768767
return figManager.canvas.figure
769768

770769
def gca(**kwargs):

0 commit comments

Comments
 (0)
0