From: Goyo <goy...@gm...> - 2011-05-11 22:53:43
|
2011/5/12 David Andrews <irb...@gm...>: > Hi, > > I've come across something I don't entirely understand in the > behaviour of gridspec. It's not obvious from the code & docs for this > module, but is it only supposed to be able to deal with 'square' > layouts, e.g. 3x3, 4x4 etc? > > Taking some code from an example on the gridspec page ... > > import matplotlib.pylab as plt > import matplotlib.gridspec as gridspec > #gs = gridspec.GridSpec(3, 3) # OK > gs = gridspec.GridSpec(6, 3) # Will cause an error later on > ax1 = plt.subplot(gs[0, :]) > ax2 = plt.subplot(gs[1,:-1]) > ax3 = plt.subplot(gs[1:,-1]) > ax4 = plt.subplot(gs[-1,0]) > ax5 = plt.subplot(gs[-1,-2]) > plt.show() > > ... will fail if that line is uncommented, giving an index error. Works for me. Ubuntu 11.04 Natty, stock python 2.7.1 and matplotlib 1.0.1 from https://launchpad.net/~valavanisalex/+archive/matplotlib. |