Global Index (short | long) | Local contents | Local Index (short | long)
subplot_talk(nrow, ncol, thisPlot);
subplot_talk(nrow, ncol, thisPlot); Assumes a 1.5 inch margin on the left, 1 inch margin on the right, and a 1.25 inch margin on top and a 1.5 inch margin on the bottom
function subplot_talk(nrow, ncol, thisPlot); ps = get(gcf, 'PaperSize'); lmarg = 1.5 ./ ps(1); rmarg = 1.5 ./ ps(1); tmarg = 1.4 ./ ps(2); bmarg = 1.6 ./ ps(2); plotsiz = [1-lmarg-rmarg 1-tmarg-bmarg]; ydim = plotsiz(2)./nrow; xdim = plotsiz(1)./ncol; thisCol = mod(thisPlot-1, ncol)+1; thisRow = floor((thisPlot-1)./ncol)+1; relsiz = 0.9; reloff = 1-relsiz; if ncol > 1; if nrow > 1; pos = [lmarg + (thisCol-1)*xdim*(1 + reloff/(ncol-1)) ... 1 - tmarg - (thisRow)*ydim + (nrow-thisRow)*reloff*ydim/(nrow-1) ... relsiz*xdim relsiz*ydim]; else pos = [lmarg + (thisCol-1)*xdim*(1 + reloff/(ncol-1)) ... 1 - tmarg - (thisRow)*ydim ... relsiz*xdim ydim]; end else if nrow > 1; pos = [lmarg + (thisCol-1)*xdim ... 1 - tmarg - (thisRow)*ydim + (nrow-thisRow)*reloff*ydim/(nrow-1) ... xdim relsiz*ydim]; else pos = [lmarg + (thisCol-1)*xdim ... 1 - tmarg - (thisRow)*ydim ... xdim ydim]; end end subplot('position', pos);