-
Notifications
You must be signed in to change notification settings - Fork 0
/
simplewaterfall.m
174 lines (171 loc) · 5.2 KB
/
simplewaterfall.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
% simplewaterfall(x,z,scale,step,type,exc,rcv)
% simplewaterfall is a simple version of waterfall, used to dispaly multi
% trace data in the same temporal or spacical scale
% Input:
% x, the temporal or spacial sampling node, more closer to the top or
% the left, more early or more near
% z, the multi-channel data, every column is a time series of a
% receiver, more closer to the top, the more previous time from now
%
% scale, the scale vetor, supporting diffrent scaling for different trace
% step, the step between two traces, supporting varying step
% type, two common display ways: 1. like seismic section time series in
% the same spacial scale. 2. spacial series in the same temporal
% scale. Others: 3. fill
% log, whether using logarithmic scale
% exc, the exclued trace indices or temporal node indices
% rcv, the postion indices
function simplewaterfall(x,z,scale,step,type,rcv,str,log,exc)
if nargin<6
rcv=step;
end
if nargin<8
log=0;
end
if nargin<9
exc=-1;
end
if length(x) == numel(x)
x=v2col(x);
end
[m,n]=size(z);
[mx,nx]=size(x);
if(type==1)
if mx==1 && nx>1
x=x';
end
for i=1:n % i the traces of data
if(isempty(find(i==exc)))
if(log==1)
semilogy(z(:,i)*scale(i)+sum(step(1:i)),x,'k');
else
plot(z(:,i)*scale(i)+step(i)*i,x,'k')
end
hold on;
end
end
for i=1:n
if(log==1)
semilogy([sum(step(1:i)),sum(step(1:i))],[x(1),x(end)],'--');
else
plot([sum(step(1:i)),sum(step(1:i))],[x(1),x(end)],'--');
end
end
axis([0,sum(step),min(x)-0.1*min(x),max(x)]);axis ij;
elseif type==2
if mx>1 && nx==1
x=x';
end
for i=1:n % i the time step
if(isempty(find(i==exc)))
if(log==1)
semilogx(x,z(:,i)*scale(i)+step(i)*i,'r');
else
plot(x,z(:,i)*scale(i)+sum(step(1:i)),'r');
% if i>1
% area(x,z(:,i),sum(step(1:i-1)));
% else
% area(x,z(:,i),0);
% end
end
hold on;
x=v2col(x);
X=[x',fliplr(x')];
y2=z(:,i)*scale(i)+sum(step(1:i));y2=y2';
y1=ones(1,length(x))*sum(step(1:i));
Y=[y1,fliplr(y2)];
fill(X,Y,'r');
end
end
for i=1:n
plot([x(1),x(end)],[sum(step(1:i)),sum(step(1:i))],'-k');
end
cc=0;
for i=1:3:length(step)
cc=cc+1;
ytick_(cc)=sum(step(1:i));
end
set(gca,'yTick',ytick_,'yTicklabel',rcv(1:3:end));
% yticklabel_rotate(ytick_,90);
axis([min(x)-0.1*min(x),max(x),0,sum(step)+step(end)]);
elseif type==3
for i=1:n % i the traces of data
% if i==18
% i
% end
if(isempty(find(i==exc, 1)))
ss=sum(step(1:i));
if length(x) ~= numel(x)
xx=x(:,i);
else
xx=x;
end
fill([z(:,i)*scale(i)+ss;ss*ones(m,1)],[xx;xx(end:-1:1)],'r','edgealpha',0);
end
hold on;
plot([sum(step(1:i)),sum(step(1:i))],[min(min(x)),max(max(x))],'-k');
end
axis([0,sum(step)+step(end),min(min(x))-0.1*min(min(x)),max(max(x))]);
axis ij;
xlabel('Distance (m)','Fontsize',14);ylabel('Time (s)','fontsize',14);
if ~isempty(str)
title(str,'fontsize',14);
end
set(gca,'yTicklabel',get(gca,'yTicklabel'),'Fontweight','bold','Fontsize',14,...
'xTicklabel',v2col(rcv));
xt=get(gca,'xTick');
if(xt(1)<step(1))
xt(1)=step(1);
end
if(xt(end)>sum(step))
xt(end)=sum(step);
end
if xt(end)<sum(step)
xt=[xt,sum(step)];
end
[lb,loc]=ismember(xt,cumsum(step));
set(gca,'xTick',xt,'xTickLabel',rcv(loc));
if log==1
set(gca,'yscale','log');
end
elseif type==4
for i=1:n % i the traces of data
if(isempty(find(i==exc, 1)))
ss=sum(step(1:i));
if length(x) ~= numel(x)
xx=x(:,i);
else
xx=x;
end
fill([z(:,i)*scale(i)+ss;ss*ones(m,1)],[xx;xx(end:-1:1)],'r','edgealpha',0);
end
hold on;
% plot([sum(step(1:i)),sum(step(1:i))],[min(min(x)),max(max(x))],'-k');
end
axis([0,sum(step)+step(end),min(min(x))-0.1*min(min(x)),max(max(x))]);
axis ij;
xlabel('Index','Fontsize',14);ylabel('Time (s)','fontsize',14);
if ~isempty(str)
title(str,'fontsize',14);
end
set(gca,'yTicklabel',get(gca,'yTicklabel'),'Fontweight','bold','Fontsize',14,...
'xTicklabel',v2col(rcv));
xt=get(gca,'xTick');
if(xt(1)<step(1))
xt(1)=step(1);
end
if(xt(end)>sum(step))
xt(end)=sum(step);
end
if xt(end)<sum(step)
xt=[xt,sum(step)];
end
[lb,loc]=ismember(xt,cumsum(step));
set(gca,'xTick',xt,'xTickLabel',rcv(loc));
if log==1
set(gca,'yscale','log');
end
else
error(1,'type must be either 1,2 or 3,4');
end
hold off;