| 1 |
% DiagPlotTitles is called by DiagPlot and cannot be used seperately. |
| 2 |
|
| 3 |
|
| 4 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 5 |
% Add titles % |
| 6 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 7 |
|
| 8 |
% Optionally put on a subplot title. The subplot title will always contain |
| 9 |
% the field name and it's corresponding units. Optional subplot title |
| 10 |
% information that is defined in DiagPlotParam: |
| 11 |
% |
| 12 |
% Option (0/1) Description |
| 13 |
% ------------------------------------------------------------- |
| 14 |
% SubplotExp Experiment |
| 15 |
% SubplotSlc SliceType information |
| 16 |
% SubplotAvg Averaging information |
| 17 |
% SubplotPst PlotStyle information |
| 18 |
% SubplotMinMax Minimum and maximum |
| 19 |
% SubplotModelTime Model time |
| 20 |
% |
| 21 |
% Note that for certain types of SliceType, the longitude ('i=#'), latitude |
| 22 |
% ('j=#'), or height ('k=#') information is included as well. Little |
| 23 |
% strings are built up for each title option (left as '' if option is |
| 24 |
% turned off), and at the end concatenated together to make the title |
| 25 |
% string. This should make it easy to reorder things as desired. |
| 26 |
if SubplotTitle |
| 27 |
info = page{inrow}{incol}; |
| 28 |
|
| 29 |
% Experiment information. |
| 30 |
trltxt = ''; |
| 31 |
if SubplotExp |
| 32 |
trltxt = [info{itrl},'; ']; |
| 33 |
end |
| 34 |
|
| 35 |
% Field and unit information. |
| 36 |
fldtxt = ''; |
| 37 |
if SubplotFld |
| 38 |
if isequal(cmp,'OvF') |
| 39 |
fldtxt = ['Fld = Various [',units,']; ']; |
| 40 |
else |
| 41 |
fldtxt = ['Fld = ',fln,' [',units,']; ']; |
| 42 |
end |
| 43 |
end |
| 44 |
|
| 45 |
% Model time information. |
| 46 |
timtxt = ''; |
| 47 |
if SubplotModelTime |
| 48 |
y1 = num2str(time{inrow}{incol}(1)); |
| 49 |
y2 = num2str(time{inrow}{incol}(end)); |
| 50 |
timtxt = ['Yrs = [',y1,',',y2,']; ']; |
| 51 |
end |
| 52 |
|
| 53 |
% Configuration information. |
| 54 |
contxt = '('; |
| 55 |
if SubplotSlc |
| 56 |
slc = info{islc}; |
| 57 |
contxt = [contxt,'Slc = ''',slc,''', ']; |
| 58 |
index = str2num(slc(3:end)); |
| 59 |
if isequal(slc(1:2),'i=') |
| 60 |
contxt = [contxt,'lon = ',num2str(XL(index)),', ']; |
| 61 |
elseif isequal(slc(1:2),'j=') |
| 62 |
contxt = [contxt,'lat = ',num2str(YL(index)),', ']; |
| 63 |
elseif isequal(slc(1:2),'k=') |
| 64 |
contxt = [contxt,'pre = ',num2str(ZC(index)),', ']; |
| 65 |
end |
| 66 |
end |
| 67 |
if SubplotAvg |
| 68 |
if isequal(cmp,'OvC') |
| 69 |
contxt = [contxt,'Avg = ''Various'', ']; |
| 70 |
else |
| 71 |
contxt = [contxt,'Avg = ''',page{inrow}{incol}{iavg},''', ']; |
| 72 |
end |
| 73 |
end |
| 74 |
if SubplotPst |
| 75 |
contxt = [contxt,'Pst = ''',pst,''', ']; |
| 76 |
end |
| 77 |
if SubplotSlc | SubplotAvg | SubplotPst |
| 78 |
contxt = [contxt(1:end-2),'); ']; |
| 79 |
else |
| 80 |
contxt = ''; |
| 81 |
end |
| 82 |
|
| 83 |
% Data minimum/maximum information. |
| 84 |
minmaxtxt = ''; |
| 85 |
if SubplotMinMax |
| 86 |
clear mn mx; |
| 87 |
if ismember(cmp,{'OvC','OvE','OvF'}) |
| 88 |
for intrl = 1:ntrl |
| 89 |
mn(intrl) = min(data{inrow}{intrl}(:)); |
| 90 |
mx(intrl) = max(data{inrow}{intrl}(:)); |
| 91 |
end |
| 92 |
mn = num2str(min(mn(:))); |
| 93 |
mx = num2str(max(mx(:))); |
| 94 |
else |
| 95 |
mn = num2str(min(data{inrow}{incol}(:))); |
| 96 |
mx = num2str(max(data{inrow}{incol}(:))); |
| 97 |
end |
| 98 |
minmaxtxt = ['[Min,Max] = [',mn,',',mx,']; ']; |
| 99 |
end |
| 100 |
|
| 101 |
% Throw on the subplot title. |
| 102 |
titlestr = [trltxt,fldtxt,timtxt,contxt,minmaxtxt]; |
| 103 |
titlestr = AddSlashesBeforeUnderscores(titlestr(1:end-2)); |
| 104 |
title(titlestr,'fontsize',fs_sptitle); |
| 105 |
end |
| 106 |
|
| 107 |
% Optionally put on overall figure title containing user defined figure |
| 108 |
% title and date of when the analysis was run (not the when the actual |
| 109 |
% experiment was run). This is added as a text string to the first |
| 110 |
% subplot. |
| 111 |
if FigureTitle |
| 112 |
if isp == 1 |
| 113 |
xi = 0; |
| 114 |
yi = 1+titlefac*(dyt/dy); |
| 115 |
titlestr = [pagename,' (Date = ',date,')']; |
| 116 |
titlestr = AddSlashesBeforeUnderscores(titlestr); |
| 117 |
text(xi,yi,titlestr,'units','normalized','fontsize',fs_title); |
| 118 |
end |
| 119 |
end |