📄 s_wplot.m
字号:
if length(scale) == 1
yi=yi*scale;
elseif length(scale) == ntr
yi=yi*spdiags(scale(:),0,ntr,ntr);
else
error(' Scale factor must be scalar or vector of length equal to the number of traces')
end
end
if nargout == 1
aux.scale=scale;
end
% Create figure window (unless an existing figure is to be used)
if strcmpi(param.figure,'new')
if isempty(param.orient)
if ntr > 10
figure_handle=lfigure;
else
figure_handle=pfigure;
end
else
if strcmpi(param.orient,'portrait')
figure_handle=pfigure;
else
figure_handle=lfigure;
end
end
%
set(figure_handle,'Color','w')
wseismic_scrollbar_menu(figure_handle,seismic,param.direction);
figure_export_menu(figure_handle);
else
figure_handle=gcf;
end
if nargout > 0
aux.figure_handle=figure_handle;
end
set(gcf,'DoubleBuffer','on')
% dx_aver=(max(xi)-min(xi))/length(xi)
axis([min(xi)-dx*max([param.deflection,1]),max(xi)+dx*max([param.deflection,1]),seismic.first,seismic.last]);
hold on
ha=get(gcf,'CurrentAxes');
set(ha,'ydir','reverse')
set(ha,'XAxisLocation','top');
% Handle reversal of plot direction
if strcmpi(param.direction,'r2l')
set(ha,'xdir','reverse')
yi=-yi;
temp=param.trough_fill;
param.trough_fill=param.peak_fill;
param.peak_fill=temp;
elseif ~strcmpi(param.direction,'l2r')
error(['Keyword for plot direction is wrong (',param.direction,')'])
end
if strcmpi(param.figure_only,'yes')
return
end
% Check if there are NaNs in the seismic data
if isfield(seismic,'null')
isnull=1;
else
isnull=0;
end
% Plot data
if strcmpi(param.quality,'draft')
ue_seismic_plot(times,yi,xi,isnull,param)
else
ue_seismic_plot_ps(times,yi,xi,isnull,param)
end
if strcmpi(param.tracking,'yes') & strcmpi(param.figure,'new')
% Add cursor tracking
[dummy,xinfo]=s_gh(seismic,param.annotation);
y=linspace(seismic.first,seismic.last,nsamp);
yinfo=info4time(seismic);
initiate_3d_tracking(seismic.traces,xi,y,xinfo,yinfo,{'amplitude','','Amplitude'})
end
% Add annotation of horizontal axis
if ~annotlog
v=axis;
xil=xi(indices);
annol=annotation(indices);
add_xaxis([xil',annol'],'',{'location','top'});
end
% Add label of horizontal axis
% (if 5 or more traces or annotation other than trace number)
if ~strcmpi(param.annotation,'trace_no') | ntr > 4
xtext=s_gd(seismic,param.annotation);
hunits=s_gu(seismic,param.annotation);
if ~isempty(xtext) & ~strcmpi(xtext,'not available')
if ~isempty(hunits) & ~strcmpi(hunits,'n/a')
xtext=[xtext,' (',hunits,')'];
end
hxlabel=xlabel(xtext);
v=get(hxlabel,'Position'); % Preserve position of x-axis label
else
hxlabel=xlabel('');
end
else
hxlabel=xlabel('');
set(gca,'XTickLabel',[])
end
if uniform & (~strcmpi(param.annotation,'trace_no') | ntr > 4)
% set(gca,'XTickLabel',[]); % Delete original annotation but
try % keep x-axis label at original position
set(hxlabel,'Position',v);
catch
end
end
grid on;
set(ha,'gridlinestyle','-','box','on','xgrid','off')
% Title
if ~isempty(param.title)
if iscell(param.title) % Handle multi-line titles
mytitle(param.title{1})
else
mytitle(param.title)
end
end
if strcmpi(param.figure,'new')
if strcmpi(param.orient,'landscape')
time_stamp
else
time_stamp_p
end
end
zoom on
hold off
if nargout == 0
clear aux
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function ue_seismic_plot(times,traces,location,isnull,param)
% Function plot seismic traces at horizontal locations controlled by location
% global param
if ~isempty(param.wiggle)
wiggle=1;
else
wiggle=0;
end
dt=times(2)-times(1);
times_orig=times;
for ii=1:size(traces,2)
skip=0;
if isnull
idx=find(~isnan(traces(:,ii)));
if isempty(idx)
skip=1;
else
y=traces(idx,ii);
times=times_orig(idx);
end
else
y=traces(:,ii);
end
if ~skip
chg=find(y(1:end-1).*y(2:end) < 0);
x_zero=abs(y(chg)./(y(chg+1)-y(chg)))*dt+times(chg);
[x_data,idx]=sort([times(1);times;x_zero;times(end)]);
y_data=[0;y;zeros(length(x_zero),1);0];
y_data=y_data(idx);
if ~isempty(param.peak_fill);
% y_data=[0;y_data;0])];
pos=find(y_data >= 0);
h1=fill(y_data(pos)+location(ii),x_data(pos),param.peak_fill);
set(h1,'EdgeColor','none')
end
if ~isempty(param.trough_fill);
% y_data=[0;y_data;min([y(end),0])];
neg=find(y_data <= 0);
h1=fill(y_data(neg)+location(ii),x_data(neg),param.trough_fill);
set(h1,'EdgeColor','none')
end
if ~isempty(param.trough_fill) | ~isempty(param.peak_fill)
plot([location(ii),location(ii)],[times(2),times(end)],'w-')
end
if wiggle
line(y_data(2:end-1)+location(ii),x_data(2:end-1),'Color',param.wiggle, ...
'EraseMode','none','LineWidth',param.wiggle_width);
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function ue_seismic_plot_ps(times,traces,location,isnull,param)
% Function plot seismic traces at horizontal locations controlled by location
% Avoids vertical lines from top to bottom on some PS interpreters
% Much slower than ue_seismic_plot
% global param
if ~isempty(param.wiggle)
wiggle=1;
else
wiggle=0;
end
dt=times(2)-times(1);
times_orig=times;
for ii=1:size(traces,2)
skip=0;
if isnull
idx=find(~isnan(traces(:,ii)));
if isempty(idx)
skip=1;
else
y=traces(idx,ii);
times=times_orig(idx);
end
else
y=traces(:,ii);
end
if ~skip
chg=find(y(1:end-1).*y(2:end) < 0);
x_zero=abs(y(chg)./(y(chg+1)-y(chg))).*dt+times(chg);
[x_data,idx]=sort([times(1);times;x_zero;times(end)]);
y_data=[0;y;zeros(length(x_zero),1);0];
y_data=y_data(idx);
if ~isempty(param.peak_fill);
pos=find(y_data >= 0);
% y_pos=y_data(pos); pos=find(y_data >= 0);
ind1=find(diff(pos) > 1);
ind=[pos(1),reshape([pos(ind1)';pos(ind1+1)'],1,2*length(ind1)),pos(end)];
% x_pos=x_data(pos);
for kk=1:2:length(ind)-1;
index=ind(kk):ind(kk+1);
fill(y_data(index)+location(ii),x_data(index),param.peak_fill, ...
'erasemode','none','EdgeColor','none');
end
end
if ~isempty(param.trough_fill);
neg=find(y_data <= 0);
ind=find(diff(neg) > 1);
ind=[neg(1),reshape([neg(ind)';neg(ind+1)'],1,2*length(ind)),neg(end)];
% y_neg=y_data(neg);
% x_neg=x_data(neg);
for kk=1:2:length(ind)-1
index=ind(kk):ind(kk+1);
fill(y_data(index)+location(ii),x_data(index),param.trough_fill, ...
'erasemode','none','EdgeColor','none');
end
end
if wiggle
line(y_data(2:end-1)+location(ii),x_data(2:end-1),'Color',param.wiggle, ...
'erasemode','none','LineWidth',param.wiggle_width);
end
end
end
plot_box(axis,'k')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -