📄 s_wplot.m
字号:
scale=(dx*param.deflection)./(trace_max+eps)'; yi=yi*spdiags(scale,0,ntr,ntr); else scale=dx*param.deflection/(max(trace_max)+eps); yi=yi*scale; endelse scale=param.scale; 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') endendif 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') figure_export_menu(figure_handle); wseismic_scrollbar_menu(figure_handle,seismic,param.direction);else figure_handle=gcf;endif nargout > 0 aux.figure_handle=figure_handle;endset(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 onha=get(gcf,'CurrentAxes');set(ha,'ydir','reverse')set(ha,'XAxisLocation','top');% Handle reversal of plot directionif 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,')'])endif strcmpi(param.figure_only,'yes') returnend% Check if there are NaNs in the seismic dataif isfield(seismic,'null') isnull=1;else isnull=0;end% Plot dataif strcmpi(param.quality,'draft') ue_seismic_plot(times,yi,xi,isnull,param) else ue_seismic_plot_ps(times,yi,xi,isnull,param)endif (isempty(param.tracking) & strcmpi(param.figure,'new')) | ... strcmpi(param.tracking,'yes')% Add cursor tracking [dummy,xinfo]=s_gh(seismic,param.annotation); %#ok First output argument is not required y=linspace(seismic.first,seismic.last,nsamp); yinfo=info4time(seismic); if ~uniform xi2use=xi; else xi2use=s_gh(seismic,param.annotation); end initiate_3d_tracking4seismic(seismic.traces,xi2use,y,xinfo,yinfo,{'amplitude','','Amplitude'})else yinfo=info4time(seismic); ylabel([yinfo{3},' (',yinfo{2},')'])end% Add annotation of horizontal axisif ~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(''); endelse hxlabel=xlabel(''); set(gca,'XTickLabel',[])endif 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 endendgrid on; set(ha,'gridlinestyle','-','box','on','xgrid','off')% Titleif ~isempty(param.title) if iscell(param.title) % Handle multi-line titles mytitle(param.title{1}) else mytitle(param.title) endendif strcmpi(param.figure,'new') timeStampendzoom offhold off if nargout == 0 clear auxend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function ue_seismic_plot(times,traces,location,isnull,param)% Function plot seismic traces at horizontal locations controlled by location% global paramif ~isempty(param.wiggle) wiggle=1;else wiggle=0;enddt=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,1)]; y_data=y_data(idx); if ~isempty(param.peak_fill); 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); 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 endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%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 paramif ~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)]; 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 endendbox on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -