📄 s_wplot.m
字号:
else scale=param.scale; if length(scale) == 1 yi=yi*scale; elseif length(scale) == ntr for ii=1:ntr yi(:,ii)=yi(:,ii)*scale(ii); end else error(' Scale factor must be a scalar or a vector of length equal to the number of traces') endend% 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','DoubleBuffer',param.doublebuffer) wseismic_scrollbar_menu(figure_handle,seismic,param.direction);elseif strcmpi(param.figure,'old') figure_handle=gcf;else error(['Unknown parameter for keyword "figure": "',param.figure,'"'])end% Handle background in axis areaif ~strcmpi(param.background,'gray') && ~strcmpi(param.background,'grey') try set(gca,'Color',param.background) catch %#ok disp([' Probably illegal background color: "',param.background,'".']) endelse bgGrayendaxis([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','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% Plot dataif strcmpi(param.quality,'draft') handles=ue_seismic_plot(times,yi,xi,isnullvalue,param);else handles=ue_seismic_plot_ps(times,yi,xi,isnullvalue,param);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 %#ok endendset(ha,'gridlinestyle','-','box','on','xgrid','off','ygrid','on')% Titleif ~isempty(param.title) if iscell(param.title) % Handle multi-line titles mytitle(param.title{1}) else mytitle(param.title) endendif (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*param.polarity,xi2use,y,xinfo,yinfo,{'amplitude','','Amplitude'})else yinfo=info4time(seismic); ylabel([yinfo{3},' (',yinfo{2},')'])endzoom offhold off if nargout > 0 aux.figure_handle=figure_handle; aux.scale=scale; aux.handles=handles;end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function handles=ue_seismic_plot(times,traces,location,isnullvalue,param)% Function plot seismic traces at horizontal locations controlled by locationprecision=class(traces);if ~isempty(param.wiggle) wiggle=true;else wiggle=false;end% dt=times(2)-times(1);times_orig=times;ntr=size(traces,2);handles=zeros(ntr,3);for ii=1:ntr skip=false; if isnullvalue idx=find(~isnan(traces(:,ii))); if isempty(idx) skip=true; 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))).*(times(chg+1)-times(chg))+times(chg); [x_data,idx]=sort([times(1);times;x_zero;times(end)]); y_data=[0;y;zeros(length(x_zero)+1,1,precision)]; y_data=y_data(idx); if ~isempty(param.peak_fill); pos=find(y_data >= 0); handles(ii,1)=fill(y_data(pos)+location(ii),x_data(pos),param.peak_fill,'EdgeColor','none'); end if ~isempty(param.trough_fill); neg=find(y_data <= 0); handles(ii,2)=fill(y_data(neg)+location(ii),x_data(neg),param.trough_fill,'EdgeColor','none'); end if wiggle handles(ii,3)=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 handles=ue_seismic_plot_ps(times,traces,location,isnullvalue,param)% Function plots seismic traces at horizontal locations controlled by location% Avoids vertical lines from top to bottom on some PS interpreters% Much slower than ue_seismic_plotprecision=class(traces);if ~isempty(param.wiggle) wiggle=true; else wiggle=false;end times_orig=times;ntr=size(traces,2);handles=zeros(ntr,3);for ii=1:ntr skip=false; if isnullvalue idx=find(~isnan(traces(:,ii))); if isempty(idx) skip=true; 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))).*(times(chg+1)-times(chg))+times(chg); [x_data,idx]=sort([times(1);times;x_zero;times(end)]); y_data=[0;y;zeros(length(x_zero),1,precision);0]; y_data=y_data(idx); if ~isempty(param.peak_fill); 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)]; for kk=1:2:length(ind)-1; index=ind(kk):ind(kk+1); handles(ii,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); handles(ii,2)=fill(y_data(index)+location(ii),x_data(index),param.trough_fill, ... 'erasemode','none','EdgeColor','none'); end end if wiggle handles(ii,3)=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 seismic=select_subset_no1(seismic,param)% Select requested subset of the seismic dataglobal S4Mhistory=S4M.history; % Preserve value of global variable S4M.historyS4M.history=false;if isempty(param.times) seismic=s_select(seismic,{'traces',param.traces});elseif iscell(param.times) seismic=s_select(seismic,{'traces',param.traces},{'null',NaN}, ... {'times',param.times{1},param.times{2}});else seismic=s_select(seismic,{'traces',param.traces},{'null',NaN}, ... {'times',param.times(1),param.times(2)});endS4M.history=history; % Restore history setting
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -