## [Matplotlib-users] subplot2grid weird for non-square shapes

 [Matplotlib-users] subplot2grid weird for non-square shapes From: Erik Tollerud - 2010-08-28 05:18:19 ```If been playing around with the new Gridspec and subplot2grid stuff, and it's pretty cool... one thing is confusing me though: It doesn't seem to make any sense if the grid is non-square. For example, suppose a 2x6 grid, which I will number like so: 1 3 5 7 9 11 2 4 6 8 10 12 I want ax1 to take up 1,2,3, and 4; ax2 to be 5,6,7,8; ax3 should be 9 and 11; and ax4 should be 10 and 12. My assumption would be to do this: ax1=plt.subplot2grid((2,6),(0,0),rowspan=2,colspan=2) ax2=plt.subplot2grid((2,6),(0,2),rowspan=2,colspan=2) ax3=plt.subplot2grid((2,6),(0,4),rowspan=2,colspan=1) ax4=plt.subplot2grid((2,6),(1,4),rowspan=2,colspan=1) But instead, apparently random partterns of axes appear and some to override each other so that only one subplot is present in the end... what's going on here? -- Erik Tollerud ```

 [Matplotlib-users] subplot2grid weird for non-square shapes From: Erik Tollerud - 2010-08-28 05:18:19 ```If been playing around with the new Gridspec and subplot2grid stuff, and it's pretty cool... one thing is confusing me though: It doesn't seem to make any sense if the grid is non-square. For example, suppose a 2x6 grid, which I will number like so: 1 3 5 7 9 11 2 4 6 8 10 12 I want ax1 to take up 1,2,3, and 4; ax2 to be 5,6,7,8; ax3 should be 9 and 11; and ax4 should be 10 and 12. My assumption would be to do this: ax1=plt.subplot2grid((2,6),(0,0),rowspan=2,colspan=2) ax2=plt.subplot2grid((2,6),(0,2),rowspan=2,colspan=2) ax3=plt.subplot2grid((2,6),(0,4),rowspan=2,colspan=1) ax4=plt.subplot2grid((2,6),(1,4),rowspan=2,colspan=1) But instead, apparently random partterns of axes appear and some to override each other so that only one subplot is present in the end... what's going on here? -- Erik Tollerud ```
 Re: [Matplotlib-users] subplot2grid weird for non-square shapes From: Jae-Joon Lee - 2010-08-28 16:11:46 ```Thanks for reporting. It turns out a (major) bug in gridspec, which should be fixed in r8667 & r8668. You code should work (except the rowspan and colspan needs to be exchanged for ax3 and ax4). Regards, -JJ On Sat, Aug 28, 2010 at 2:17 PM, Erik Tollerud wrote: > If been playing around with the new Gridspec and subplot2grid stuff, > and it's pretty cool... one thing is confusing me though: It doesn't > seem to make any sense if the grid is non-square.  For example, > suppose a 2x6 grid, which I will number like so: > > 1 3 5 7 9   11 > 2 4 6 8 10 12 > I want ax1 to take up 1,2,3, and 4; ax2 to be 5,6,7,8; ax3 should be 9 > and 11; and ax4 should be 10 and 12.  My assumption would be to do > this: > > ax1=plt.subplot2grid((2,6),(0,0),rowspan=2,colspan=2) > ax2=plt.subplot2grid((2,6),(0,2),rowspan=2,colspan=2) > ax3=plt.subplot2grid((2,6),(0,4),rowspan=2,colspan=1) > ax4=plt.subplot2grid((2,6),(1,4),rowspan=2,colspan=1) > > But instead, apparently random partterns of axes appear and some to > override each other so that only one subplot is present in the end... > what's going on here? > > -- > Erik Tollerud > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ```