matplotlib/matplotlib — pull request #226 by mdboom (2013-08-14 15:19:08+00:00)
Title: Mismanagement of subplots. Bug in GridSpecBase.__getitem__()

[Original report at SourceForge, opened Mon Aug 2 08:20:09 2010](https://sourceforge.net/tracker/?func=detail&aid=3038240&group_id=80706&atid=560722)

Hello everybody,

I found a bug using the subplot facilities placed in the file "gridspec.py". I propose a solution which you may find in the attached patch.

The problem emerged making non-trivial subplots using statemensts like:

mp.subplot(gs1[1,0:2])
tmp2 = gs1[1,0:2]

To summarize, if the grid is thought as row-major ordered (as one can deduce from the lines like "rowNum, colNum = divmod(self.num1, ncols)"), the formula:

num1 = row1*nrows + col1

is not correct. Instead num1 = row1*ncols + col1 solves the problem on my local copy of matplotlib.

When considering the patch for installation, pay attention to the fact that my version of the code didn't include the iterator method.

Cheers,
Anton

### SourceForge History

* On Tue Aug 3 08:03:22 2010, by arcmag: priority: 5
* On Mon Aug 2 08:20:10 2010, by arcmag: File Added: 382012: gridspec.py.patch