📄 plotseismic.m
字号:
%see if the figure must be resized
resize=0;
if(ysize>ysizeold | printhist)
resize=1;
funits=get(gcf,'units');
pfig=get(gcf,'position');
if(ysize>ysizeold)
set(gcf,'units','normalized');
pfig2=get(gcf,'position');
pfig3=[pfig2(1) 0 pfig2(3) 1];
set(gcf,'position',pfig3);
end
set(gcf,'units',funits)
end
set(hclose,'visible','off');
set(hhard,'visible','off');
set(hamp,'visible','off');
set(htitbut,'visible','off');
set(hcopyclip,'visible','off');
set(hbigfont,'visible','off');
set(hslider,'visible','off');
set(hlabel,'visible','off');
set(hpolbut,'visible','off');
set(hamplabel,'visible','off');
set(hampslider,'visible','off');
%determine papersize
punits=get(gcf,'paperunits');
set(gcf,'paperunits','inches');
ppos=get(gcf,'paperposition');
psize=get(gcf,'papersize');
ysizepaper=1.2*ysize;
if(ysizepaper>ppos(4))
ymargin=min([abs(psize(2)-ysizepaper), .5]);
newppos=ppos;
newppos(2)=ymargin/2;
newppos(4)=ysizepaper;
set(gcf,'paperposition',newppos);
% if(newppos(4)+ymargin>psize(2))
% npages=ceil((newppos(4)+ymargin)/psize(2));
% newpsize=psize;
% newpsize(2)=psize(2)*npages;
% set(gcf,'papersize',newpsize)
% end
end
printdlg
set(hclose,'visible','on');
set(hhard,'visible','on');
set(hamp,'visible','on');
set(htitbut,'visible','on');
set(hcopyclip,'visible','on');
set(hbigfont,'visible','on');
set(hslider,'visible','on');
set(hlabel,'visible','on');
set(hpolbut,'visible','on');
set(hamplabel,'visible','on');
set(hampslider,'visible','on');
ps(4)=ysizeold;
if(resize)
set(gcf,'position',pfig);
set(gcf,'units',funits)
end
set(hseis,'position',ps);
set(hmsg,'visible','off');
set(hseis,'units','normalized');
set(gcf,'paperposition',ppos)
set(gcf,'papersize',psize);
set(gcf,'paperunits',punits);
return
elseif(strcmp(action,'replot'))
h=get(gcf,'userdata');
hclose=h(1);
hhard=h(2);
hmsg=h(3);
hseis=gca;
hamp=h(15);
hslider=h(20);
hpolbut=h(22);
hlabel=h(23);
hampslider=h(24);
xlim=h(5:6);
ylim=h(7:8);
%determine current polarity
polarity=get(hpolbut,'userdata');
phase=get(hslider,'value');
hax=get(gcf,'currentaxes');
set(gcf,'currentaxes',hseis)
ampfactors=get(hamp,'userdata');
%determine amplitude option
flag=get(hamp,'value');
if(flag==1)
fact=ampfactors(1);
elseif(flag==2)
fact=[ampfactors(1) -1];
elseif(flag==3)
fact=[ampfactors(1) -2];
end
cliplvl=ampfactors(2);
pcolor=get(hmsg,'userdata');
%get the data
stuff=get(hclose,'userdata');
seis=stuff{1};
t=stuff{2};
x=stuff{3};
cla
if(phase~=0)
seis2=get(hlabel,'userdata');
if(isempty(seis2))
seis2=hilbert(seis);
set(hlabel,'userdata',seis2);
end
seis=cos(pi*phase/180)*real(seis2)+sin(pi*phase/180)*imag(seis2);
end
plotseis( polarity*seis, t, x, 1, fact, cliplvl, 1, pcolor, hseis );
set(gca,'xaxislocation','bottom')
if(xlim(1))
set(gca,'xlim',xlim,'ylim',ylim);
end
h(5:6)=xlim;
h(7:8)=ylim;
set(gcf,'userdata',h);
elseif(strcmp(action,'toclip'))
if(ispc)
print -dbitmap
else
print -dtiff
end
elseif(strcmp(action,'bigfontetc'))
hbigfont=gcbo;
flag=get(hbigfont,'tag');
if(strcmp(flag,'to'))
set(hbigfont,'string','Normfont','tooltipstring','Restore font, linewidth, and color',...
'tag','from');
whitefig;
bigfont(gcf,1.5);
boldlines(gcf,2);
siz=get(gcf,'position');
%screen=get(0,'screensize');
%set(gcf,'position',[screen(1:2) .95*screen(3:4)])
%set(gcf,'position',[screen])
bigfig;
set(hbigfont,'userdata',siz);
else
set(hbigfont,'string','Bigfont etc','tooltipstring',...
'Double fontsize and linewidth, white background','tag','to');
greyfig;
bigfont(gcf,1/1.5,1);
boldlines(gcf,.5);
siz=get(hbigfont,'userdata');
set(gcf,'position',siz);
end
elseif(strcmp(action,'retitle'))
htit=get(gca,'title');
titstr=get(htit,'string');
newtitstr=inputdlg('Specify new title','PLOTSEISMIC wants to know',1,{titstr});
title(newtitstr{1});
elseif(strcmp(action,'polarity'))
h=get(gcf,'userdata');
hclose=h(1);
hpolbut=gcbo;
%determine current polarity
polarity=get(hpolbut,'userdata');
polarity=-polarity;%flipit
set(hpolbut,'userdata',polarity);
txt1='Polarity ';
black=[0 0 0];white=[1 1 1];
%grey=[.7529 .7529 .7529];
%grey=[0.8314 0.8157 0.7843];
grey=get(hclose,'backgroundcolor');
if( polarity==1 )
txt2='Normal';
set(hpolbut,'backgroundcolor',grey,'foregroundcolor',black)
elseif( polarity==-1 )
txt2='Reverse';
set(hpolbut,'backgroundcolor',black,'foregroundcolor',white)
else
txt2='Crazy';
end
%txt=[txt1 txt2];
%set(hpol,'label',txt);
plotseismic('replot')
elseif(strcmp(action,'phase'))
h=get(gcf,'userdata');
hmenu=h(21);
hslider=gcbo;
phase=round(get(hslider,'value'));
hlabel=get(hslider,'userdata');
set(hlabel,'string',['Phase ' int2str(phase)])
%hphase=findobj(hmenu,'tag','phase');
%txt1='Phase ';
%txt2=int2str(phase);
%set(hphase,'label',[txt1 txt2]);
plotseismic('replot');
elseif(strcmp(action,'champ'))
h=get(gcf,'userdata');
hamp=h(15);
hslider=gcbo;
pscale=get(hslider,'value');
hlabel=get(hslider,'userdata');
if(pscale<10&pscale>=1)
set(hlabel,'string',['Amp lvl ' num2str(sigfig(pscale,2))])
else
set(hlabel,'string',['Amp ' num2str(sigfig(pscale,2))])
end
%hpscale=findobj(hmenu,'tag','pscale');
% txt1='Plot scale ';
% txt2=num2str(pscale);
% set(hpscale,'label',[txt1 txt2]);
ampfactors=get(hamp,'userdata');
ampfactors(1)=pscale;
set(hamp,'userdata',ampfactors)
plotseismic('replot');
elseif(strcmp(action,'hist'))
h=get(gcf,'userdata');
htitbut=h(17);
hmenu=h(21);
hkids=get(hmenu,'children');
for k=1:length(hkids)
hist{k}=get(hkids(k),'label');
end
set(htitbut,'userdata',hist);
elseif(strcmp(action,'pubzoom'))
global XLSEIS YLSEIS
XLSEIS=get(gca,'xlim');
YLSEIS=get(gca,'ylim');
return;
elseif(strcmp(action,'matchzoom'))
h=get(gcf,'userdata');
global XLSEIS YLSEIS
if(isempty(XLSEIS))
msgbox('You must first ''publish'' one window''s Zoom limits before you can Match Zoom');
return
end
set(gca,'xlim',XLSEIS);
set(gca,'ylim',YLSEIS);
h(5:8)=[XLSEIS YLSEIS];
set(gcf,'userdata',h);
return;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -