function this_ax = subplot2(ncol, num); % % this_ax = subplot2(nCol, thisPlot); % % nCol = number of columns to be produced % thisPlot = the subplot number (standard order) % % This routine produces subplots sized and positioned % according to the dimensions specified by global_axes. % This is helpful for producing actual-sized figures % (e.g., for publications). % % See also: global_axes, subplot % global HSZ VSZ MIDV MIDH TMARG pos = [0.5 - (ncol/2)*HSZ - (ncol-1)*MIDH/2 + ... mod(num-1,ncol)*(HSZ+MIDH) ... 1 - TMARG - (ceil(num/ncol)-1)*MIDV - ceil(num/ncol)*VSZ ... HSZ VSZ]; if isreal(sqrt([pos(1:2) pos(1:2)+pos(3:4)])); subplot('position', pos); set(gca, 'box', 'on'); else er = ['The subplot is outside the figure limits.']; error(er); end if nargout == 1; this_ax = gca; end