SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <lee...@us...> - 2010年07月31日 09:18:31
Revision: 8606
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8606&view=rev
Author: leejjoon
Date: 2010年07月31日 09:18:25 +0000 (2010年7月31日)
Log Message:
-----------
make grid spec iterable
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/gridspec.py
Modified: trunk/matplotlib/lib/matplotlib/gridspec.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/gridspec.py	2010年07月31日 09:18:20 UTC (rev 8605)
+++ trunk/matplotlib/lib/matplotlib/gridspec.py	2010年07月31日 09:18:25 UTC (rev 8606)
@@ -128,6 +128,12 @@
 return figBottoms, figTops, figLefts, figRights
 
 
+ def __iter__(self):
+ nrows, ncols = self.get_geometry()
+ total = nrows*ncols
+
+ return iter([self.__getitem__(i) for i in range(total)])
+
 def __getitem__(self, key):
 """
 create and return a SuplotSpec instance.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2011年01月05日 15:43:36
Revision: 8888
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8888&view=rev
Author: leejjoon
Date: 2011年01月05日 15:43:30 +0000 (2011年1月05日)
Log Message:
-----------
gridspec.GridSpecBase.__getitem__ checks its index (original patch from Paul Ivanov)
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/gridspec.py
Modified: trunk/matplotlib/lib/matplotlib/gridspec.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/gridspec.py	2011年01月05日 15:43:01 UTC (rev 8887)
+++ trunk/matplotlib/lib/matplotlib/gridspec.py	2011年01月05日 15:43:30 UTC (rev 8888)
@@ -145,6 +145,8 @@
 else:
 if k1 < 0:
 k1 += nrows
+ if k1 >= nrows or k1 < 0 :
+ raise IndexError("index out of range")
 row1, row2 = k1, k1+1
 
 
@@ -153,6 +155,8 @@
 else:
 if k2 < 0:
 k2 += ncols
+ if k2 >= ncols or k2 < 0 :
+ raise IndexError("index out of range")
 col1, col2 = k2, k2+1
 
 
@@ -167,6 +171,8 @@
 else:
 if key < 0:
 key += total
+ if key >= total or key < 0 :
+ raise IndexError("index out of range")
 num1, num2 = key, None
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
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 によって変換されたページ (->オリジナル) /