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

Skip to content

Commit f609ebd

Browse files
committed
make grid spec iterable
svn path=/trunk/matplotlib/; revision=8606
1 parent 507ec17 commit f609ebd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/matplotlib/gridspec.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ def get_grid_positions(self, fig):
128128
return figBottoms, figTops, figLefts, figRights
129129

130130

131+
def __iter__(self):
132+
nrows, ncols = self.get_geometry()
133+
total = nrows*ncols
134+
135+
return iter([self.__getitem__(i) for i in range(total)])
136+
131137
def __getitem__(self, key):
132138
"""
133139
create and return a SuplotSpec instance.

0 commit comments

Comments
 (0)