Try this.

def get_indx(irow, icol):
    return irow*4+icol

ax = plt.subplot(gs[get_indx(0,3):get_indx(3,3)])

With 1d slicing, the axes will occupy the rectangle defined by the
start and stop location.
For example,

gs[i:j]

will occupy the rectangular area between

gs[i] and gs[j-1].

Let me know if this does not work (this is only tested w/ the svn
version and may not work with v1.0).

Regards,

-JJ


On Tue, Oct 26, 2010 at 12:30 AM, Nikolaus Rath <nikol...@rath.org> wrote:
> On 10/25/2010 11:18 AM, Jae-Joon Lee wrote:
>> On Mon, Oct 25, 2010 at 10:45 PM, Nikolaus Rath <nikol...@rath.org> wrote:
>>> So I have to instantiate GridSpec with a (rows, column), but when I
>>> index the grid I have to use (column, row).
>>>
>>> Is there any reason for this counterintuitive behaviour?
>>>
>>
>> This is not an intended behavior but a bug which affects a grid of
>> non-square shape.
>> This has been fixed in the svn version.
>>
>> Meanwhile, you may use 1-d indexing. e.g.,
>>
>> import matplotlib.pyplot as plt
>> from matplotlib.gridspec import GridSpec
>>
>> gs = GridSpec(3, 4)
>>
>> for irow in range(3):
>>     for icol in range(4):
>>         ax = plt.subplot(gs[irow*4+icol])
>
> I see, thanks. Is there also a way to use this workaround for slices? I
> want a subplot in column 4 that spans all rows...
>
>
> Best,
>
>   -Nikolaus
>
> --
>  »Time flies like an arrow, fruit flies like a Banana.«
>
>  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C
>

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to