small bugfix

Hi all,

I found a small bug, where Figure.clf() was erroneously leaving some axes
instances in the Figure.axes list. It turns out the method was deleting
items from the list while iterating over it. Attached is a patch.

Mike

clf.patch (533 Bytes)

Michael Fitzgerald wrote:

Hi all,

I found a small bug, where Figure.clf() was erroneously leaving some axes instances in the Figure.axes list. It turns out the method was deleting items from the list while iterating over it. Attached is a patch.

Mike

Mike,

Thanks for finding that rather subtle bug. I committed an equivalent change; I used tuple(self.axes) instead of copy.copy(self.axes) because for this purpose it accomplishes the same thing, but faster, and without the extra import.

Eric

ยทยทยท

------------------------------------------------------------------------

Index: figure.py

--- figure.py (revision 3198)
+++ figure.py (working copy)
@@ -1,7 +1,7 @@
"""
Figure class -- add docstring here!
"""
-import sys
+import sys, copy
import artist
from artist import Artist
from axes import Axes, Subplot, PolarSubplot, PolarAxes
@@ -515,7 +515,7 @@
         """
         Clear the figure
         """
- for ax in self.axes:
+ for ax in copy.copy(self.axes):
             ax.cla()
             self.delaxes(ax)

------------------------------------------------------------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

------------------------------------------------------------------------

_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options