-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_dot3.m
executable file
·108 lines (97 loc) · 3.44 KB
/
plot_dot3.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
function pah = plot_dot3(X,Y,Z,C,C_lim,dotsize,cmap,c_label,cborientation)
% plot_dot Plots colored dots based on Z value
%-------------------------------------------------------
% University of South Florida, Ocean Circulation Group
% Sage's Codar Processing Toolbox v1.0 + DG mods
%-------------------------------------------------------
% Usage:
% plot_dot3(X,Y,Z,C,C_lim,dotsize,cmap,c_label,cborientation)
% Input:
% X,Y = Longitude/Latitude in decimal degrees
% Z = Depth
% C = Dot value
% C_lim = [Min Max] Limits for C
% cmap = user specified colormap
% c_label = Colorbar label (if left undefined
% colorbar is not generated)
% Output: None
% Updates:
% Written by Sage 6/25/2004
% Note:0 10 bins between the limits set in Z_lim are used
% to detemine color values for Z.
% C=C_lim(1) are ignored
% 2006-07-31 DG modified to plot 3-D data, Lon->X, Lat->Y
% 2006-09-18 DG added plotting data smaller than min and larger
% than max
% 2011-04-24 DG
%-------------------------------------------------------
if ~exist('dotsize')
dotsize = 10;
end %if
% Set up the colormap to use
%cmap = jet(256);
%cmap = cmap.^1.5;
if ~exist('cmap')
cmap = jet(256);
end %if
colormap(cmap);
caxis(C_lim);
pp = [];
k = 0;
%% plot anything smaller than the specified range using the first color
minind = find(C<=C_lim(1));
if length(minind)>0
k = k+1;
pp(k)=plot3(X(minind),Y(minind),Z(minind),'.','markersize',dotsize); hold on;
set(pp(k),'color',cmap(1,:));
end %if
%% plot data according to their indexed color
ranges = [C_lim(1): (C_lim(2)-C_lim(1))/size(cmap,1) :C_lim(2)];
for ii=1:length(ranges)-1,
ind = find(C>ranges(ii) & C<=ranges(ii+1));
if length(ind)>0
k = k+1;
pp(k)=plot3(X(ind),Y(ind),Z(ind),'.','markersize',dotsize); hold on;
set(pp(k),'color',cmap(ii,:));
end
end
%% plot anything larger than the specified range using the last color
maxind = find(C>C_lim(2));
if length(maxind)>0
k = k+1;
pp(k)=plot3(X(maxind),Y(maxind),Z(maxind),'.','markersize',dotsize); hold on;
set(pp(k),'color',cmap(end,:));
end %if
pah = gca;
if exist('c_label')
% % Plot and Configure the Colorbar
% caxes=gca;
if exist('cborientation') ~= 1
color_bar=colorbar('horz');
xlabel(color_bar,c_label);
else
color_bar=colorbar('vert');
ylabel(color_bar,c_label);
end %if
set(color_bar,'clim',[C_lim(1) C_lim(2)]);
% set(color_bar,'xlim',[1 64],'xtick',[1:63/10:64],'xticklabel',num2str([Z_lim(1):((Z_lim(2)-Z_lim(1))/10):Z_lim(2)]',precision));
% set(gcf,'currentaxes',color_bar);
% yla_cb = ylabel(c_label);
% set(yla_cb,'fontsize',10,'fontweight','bold');
% set(gca,'fontsize',10,'fontweight','bold');
% set(gcf,'currentaxes',caxes);
set(color_bar,'fontsize',14,'fontweight','bold');
set(gca,'fontsize',14,'fontweight','bold');
end % c_label
%if (c_label)
% % Plot and Configure the Colorbar
% caxes=gca;
% color_bar=colorbar('horiz');
% set(gca,'clim',[C_lim(1) C_lim(2)]);
% set(color_bar,'xlim',[1 64],'xtick',[1:63/10:64],'xticklabel',num2str([Z_lim(1):((Z_lim(2)-Z_lim(1))/10):Z_lim(2)]',precision));
% set(gcf,'currentaxes',color_bar);
% yla_cb = ylabel(c_label);
% set(yla_cb,'fontsize',10,'fontweight','bold');
% set(gca,'fontsize',10,'fontweight','bold');
% set(gcf,'currentaxes',caxes);
%end % c_label