Back to home page

MITgcm

 
 

    


Warning, /utils/matlab/Graphix/GraphixPlotTitles.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit 4cf7d6e4 on 2006-06-29 18:52:07 UTC
5bbd0d07c9 Dani*0001 % DiagPlotTitles is called by DiagPlot and cannot be used seperately.
                0002 
                0003 
                0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                0005 %                              Add titles                                 % 
                0006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                0007 
                0008 % Optionally put on a subplot title.  The subplot title will always contain
                0009 % the field name and it's corresponding units.  Optional subplot title
                0010 % information that is defined in DiagPlotParam:
                0011 %
                0012 %   Option (0/1)        Description
                0013 %   -------------------------------------------------------------
                0014 %   SubplotExp          Experiment
                0015 %   SubplotSlc          SliceType information
                0016 %   SubplotAvg          Averaging information
                0017 %   SubplotPst          PlotStyle information
                0018 %   SubplotMinMax       Minimum and maximum
                0019 %   SubplotModelTime    Model time
                0020 %
                0021 % Note that for certain types of SliceType, the longitude ('i=#'), latitude
                0022 % ('j=#'), or height ('k=#') information is included as well.  Little
                0023 % strings are built up for each title option (left as '' if option is
                0024 % turned off), and at the end concatenated together to make the title
                0025 % string.  This should make it easy to reorder things as desired.
                0026 if SubplotTitle
                0027     info = page{inrow}{incol};
                0028     
4cf7d6e47a Dani*0029     if isequal(SubplotTitleOverride,'')
                0030         % Experiment information.
                0031         trltxt = '';
                0032         if SubplotExp
                0033             trltxt = [info{itrl},'; '];
5bbd0d07c9 Dani*0034         end
4cf7d6e47a Dani*0035 
                0036         % Field and unit information.
                0037         fldtxt = '';
                0038         if SubplotFld
                0039             if isequal(cmp,'OvF')
                0040                 fldtxt = ['Fld = Various [',units,']; '];
                0041             else
                0042                 fldtxt = ['Fld = ',fln,' [',units,']; '];
                0043             end
5bbd0d07c9 Dani*0044         end
4cf7d6e47a Dani*0045 
                0046         % Model time information.
                0047         timtxt = '';
                0048         if SubplotModelTime
                0049             y1 = num2str(time{inrow}{incol}(1));
                0050             y2 = num2str(time{inrow}{incol}(end));
                0051             timtxt = ['Yrs = [',y1,',',y2,']; '];
5bbd0d07c9 Dani*0052         end
4cf7d6e47a Dani*0053 
                0054         % Configuration information.
                0055         contxt = '(';
                0056         if SubplotSlc
                0057             slc = info{islc};
                0058             contxt = [contxt,'Slc = ''',slc,''', '];
                0059             index = str2num(slc(3:end));
                0060             if isequal(slc(1:2),'i=')
                0061                 contxt = [contxt,'lon = ',num2str(XL(index)),', '];
                0062             elseif isequal(slc(1:2),'j=')
                0063                 contxt = [contxt,'lat = ',num2str(YL(index)),', '];
                0064             elseif isequal(slc(1:2),'k=')
                0065                 contxt = [contxt,'pre = ',num2str(ZC(index)),', '];
                0066             end
                0067         end
                0068         if SubplotAvg
                0069             if isequal(cmp,'OvC')
                0070                 contxt = [contxt,'Avg = ''Various'', '];
                0071             else
                0072                 contxt = [contxt,'Avg = ''',page{inrow}{incol}{iavg},''', '];
5bbd0d07c9 Dani*0073             end
4cf7d6e47a Dani*0074         end
                0075         if SubplotPst
                0076             contxt = [contxt,'Pst = ''',pst,''', '];
                0077         end
                0078         if SubplotSlc | SubplotAvg | SubplotPst
                0079             contxt = [contxt(1:end-2),'); '];
5bbd0d07c9 Dani*0080         else
4cf7d6e47a Dani*0081             contxt = '';
                0082         end
                0083 
                0084         % Data minimum/maximum information.
                0085         minmaxtxt = '';
                0086         if SubplotMinMax
                0087             clear mn mx;
                0088             if ismember(cmp,{'OvC','OvE','OvF'})
                0089                 for intrl = 1:ntrl
                0090                     mn(intrl) = min(data{inrow}{intrl}(:));
                0091                     mx(intrl) = max(data{inrow}{intrl}(:));
                0092                 end
                0093                 mn = num2str(min(mn(:)));
                0094                 mx = num2str(max(mx(:)));
                0095             else
                0096                 mn = num2str(min(data{inrow}{incol}(:)));
                0097                 mx = num2str(max(data{inrow}{incol}(:)));
                0098             end
                0099             minmaxtxt = ['[Min,Max] = [',mn,',',mx,']; '];
5bbd0d07c9 Dani*0100         end
                0101 
4cf7d6e47a Dani*0102         % Throw on the subplot title.
                0103         titlestr = [trltxt,fldtxt,timtxt,contxt,minmaxtxt];
                0104         titlestr = AddSlashesBeforeUnderscores(titlestr(1:end-2));
                0105     else
                0106         titlestr = SubplotTitleOverride;
                0107     end
5bbd0d07c9 Dani*0108     title(titlestr,'fontsize',fs_sptitle);
                0109 end
                0110 
                0111 % Optionally put on overall figure title containing user defined figure
                0112 % title and date of when the analysis was run (not the when the actual
                0113 % experiment was run).  This is added as a text string to the first
                0114 % subplot.
                0115 if FigureTitle
                0116     if isp == 1
                0117         xi = 0;
                0118         yi = 1+titlefac*(dyt/dy);
                0119         titlestr = [pagename,' (Date = ',date,')'];
                0120         titlestr = AddSlashesBeforeUnderscores(titlestr);
                0121         text(xi,yi,titlestr,'units','normalized','fontsize',fs_title);
                0122     end
4cf7d6e47a Dani*0123 end
                0124 
                0125 % Add x and y axis labels.
                0126 if ~isequal(XLabel,'')
                0127     xlabel(XLabel,'fontsize',fs_axislabel);
                0128 end
                0129 if ~isequal(YLabel,'')
                0130     ylabel(YLabel,'fontsize',fs_axislabel);
                0131 end