


function my_subplot(i,imax,irow,icol,fig_title) spreads subplots on several figures according to a maximum number of subplots per figure INPUTS i: subplot number imax: total number of subplots irow: maximum number of rows in a figure icol: maximum number of columns in a figure fig_title: title to be repeated on each figure OUTPUT none SPECIAL REQUIREMENTS none


0001 function my_subplot(i,imax,irow,icol,fig_title) 0002 0003 % function my_subplot(i,imax,irow,icol,fig_title) 0004 % spreads subplots on several figures according to a maximum number of 0005 % subplots per figure 0006 % 0007 % INPUTS 0008 % i: subplot number 0009 % imax: total number of subplots 0010 % irow: maximum number of rows in a figure 0011 % icol: maximum number of columns in a figure 0012 % fig_title: title to be repeated on each figure 0013 % 0014 % OUTPUT 0015 % none 0016 % 0017 % SPECIAL REQUIREMENTS 0018 % none 0019 0020 % Copyright (C) 2003-2009 Dynare Team 0021 % 0022 % This file is part of Dynare. 0023 % 0024 % Dynare is free software: you can redistribute it and/or modify 0025 % it under the terms of the GNU General Public License as published by 0026 % the Free Software Foundation, either version 3 of the License, or 0027 % (at your option) any later version. 0028 % 0029 % Dynare is distributed in the hope that it will be useful, 0030 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0031 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0032 % GNU General Public License for more details. 0033 % 0034 % You should have received a copy of the GNU General Public License 0035 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0036 0037 nfig_max = irow*icol; 0038 if imax < nfig_max 0039 icol = ceil(sqrt(imax)); 0040 irow=icol; 0041 if (icol-1)*(icol-2) >= imax 0042 irow = icol-2; 0043 icol = icol-1; 0044 elseif (icol)*(icol-2) >= imax 0045 irow = icol-2; 0046 elseif icol*(icol-1) >= imax 0047 irow = icol-1; 0048 end 0049 end 0050 0051 i1 = mod(i-1,nfig_max); 0052 if i1 == 0 0053 figure('Name',fig_title); 0054 end 0055 0056 subplot(irow,icol,i1+1);