## Re: [Matplotlib-users] subplot

 Re: [Matplotlib-users] subplot From: Yannick Copin - 2009-05-18 21:00:16 ```Hi, Jae-Joon Lee writes: > I had a few off-list conversation with Alan, and I'm also quite agree > with him for this issue. [...] > issue 2) It is not easy (actually impossible) to make an axes > spanning multiple cells. Regarding this 2nd issue, I appreciated long ago the flexibility and ease-of-use offered by super-mongo WINDOW command (e.g. http://www.astro.princeton.edu/~rhl/sm/sm.html#SYN83). Basically, this would be the same as accepting a tuple as plotNum argument in matplotlib subplot(numRows, numCols, plotNum) to specify the extent of the composed subplot in terms of atomic subplots, e.g. ax1 = subplot(2,2,(1,3)) ax2 = subplot(2,2,2) ax3 = subplot(2,2,4) would produce the following layout: +-------+-------+ | | ax2 | | | | | ax1 +-------+ | | ax3 | | | | +-------+-------+ or ax1 = subplot(3,3,(1,5)) ax2 = subplot(3,3,(7,9)) ax3 = subplot(3,3,(3,6)) for +-------+---+ | | | | ax1 |ax3| | | | +-------+---+ | ax2 | +-----------+ My current naive implementation is the following: def add_axes(fig, nrow, ncol, extent, **kwargs): pars = fig.subplotpars figW = pars.right-pars.left # Fig size figH = pars.top-pars.bottom subW = figW / (ncol + pars.wspace*(ncol-1)) # Sub-axes size subH = figH / (nrow + pars.hspace*(nrow-1)) sepW = pars.wspace*subW # Separations sepH = pars.hspace*subH axL,axR,axB,axT = 1,0,1,0 for num in extent: assert 0