SourceForge logo
SourceForge logo
Menu

Re: [matplotlib-devel] small bugfix

From: Eric F. <ef...@ha...> - 2007年04月12日 07:44:27
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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /