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