1 |
% DiagPlotMisc is called by DiagPlot and cannot be used seperately. |
2 |
|
3 |
|
4 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
5 |
% Apply desired colorbar, contour label, tick labels, box, grid % |
6 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
7 |
|
8 |
|
9 |
% Add colorbar, except for line plots. When the colorbar is placed, reset |
10 |
% the colorbar and axes positions on the figure to match desired settings. |
11 |
% Colorbar can be turned off as desired. |
12 |
if UseColorbar |
13 |
if ~isequal(pst,'Lin') |
14 |
h=colorbar; |
15 |
cxi = xi+dx-dxcb; |
16 |
set(h,'position',[cxi,yi,dxcb,dy]); |
17 |
set(h,'fontsize',fs_colorbar); |
18 |
set(gca,'position',[xi,yi,dx-dxcb-dxcbg,dy]); |
19 |
end |
20 |
end |
21 |
|
22 |
% Reform tick labels. It the PlotStyle (pst) is 'Lin', do nothing with the |
23 |
% y-axis label as is it now a dependent variable. |
24 |
if UseNiceTickLabels |
25 |
if isequal(pltslc{inrow}{incol}(1:3),'lon') |
26 |
xtick = fac.*lontick; xticklabel = lonticklabel; |
27 |
set(gca,'xtick',xtick); set(gca,'xticklabel',xticklabel); |
28 |
elseif isequal(pltslc{inrow}{incol}(1:3),'lat') |
29 |
xtick = fac.*lattick; xticklabel = latticklabel; |
30 |
set(gca,'xtick',xtick); set(gca,'xticklabel',xticklabel); |
31 |
elseif isequal(pltslc{inrow}{incol}(1:3),'tim') |
32 |
% xtick = timtick; xticklabel = timticklabel; |
33 |
% set(gca,'xtick',xtick); set(gca,'xticklabel',xticklabel); |
34 |
end |
35 |
|
36 |
if ~isequal(pltslc{inrow}{incol}(4:6),'fld') |
37 |
if isequal(pltslc{inrow}{incol}(4:6),'lat') |
38 |
ytick = fac.*lattick; yticklabel = latticklabel; |
39 |
elseif isequal(pltslc{inrow}{incol}(4:6),'hgt') |
40 |
eval(['ytick = vertick',flu,';']); |
41 |
eval(['yticklabel = verticklabel',flu,';']); |
42 |
end |
43 |
set(gca,'ytick',ytick); |
44 |
set(gca,'yticklabel',yticklabel); |
45 |
end |
46 |
end |
47 |
|
48 |
% Add box and grid as desired. |
49 |
eval(['box ' ,Box ,';']); |
50 |
eval(['grid ',Grid,';']); |
51 |
|
52 |
% Add legend if comparison is set to one of the overlay settings: 'OvE' or |
53 |
% 'OvC'. If the 'UseLegend' flag is turned on but the comparison type is |
54 |
% not one of these overlay settings, nothing is done. |
55 |
if UseLegend && ismember(cmp,{'OvC','OvE','OvF'}) |
56 |
legendstr = ''; |
57 |
for intrl = 1:ntrl |
58 |
if isequal(cmp,'OvE'), tempname = page{inrow}{intrl}{itrl}; |
59 |
elseif isequal(cmp,'OvC'), tempname = page{inrow}{intrl}{iavg}; |
60 |
elseif isequal(cmp,'OvF'), tempname = page{inrow}{intrl}{ifln}; end |
61 |
tempname = AddSlashesBeforeUnderscores(tempname); |
62 |
legendstr = [legendstr,'''',tempname,''',']; |
63 |
end |
64 |
eval(['legend(',legendstr,num2str(LegendPlacement),')']); |
65 |
end |
66 |
|
67 |
% Add coast as appropriate. |
68 |
if Coast |
69 |
%m_proj('Mercator','lat',90,'lon',[-180,177.5]); |
70 |
m_proj('Equidistant Cylindrical','lat',90,'lon',[-180 180]); |
71 |
m_coast('color',[0 0 0]); |
72 |
%m_grid('box','on') |
73 |
%draw_coast(1.) |
74 |
end |