ezplot中如何给曲线加颜色和函数名zz

                                                                      
% ezplot绘图的修改:                                                             
                                                                                
axes('position',[0.08,0.08,0.5,0.6])                                            
ezplot('t*cos(t)','t*sin(t)',[0,4*pi])                                          
p=get(gca,'Children');                                                          
S=get(p);                                                                       
xd=get(p,'xdata');yd=get(p,'ydata');                                            
s1='set(p,''color'',''r'');  % 改颜色';                                         
s2='set(p,''LineStyle'','':'');  % 改线型';                                     
s3='set(p,''LineWidth'',2); % 改线宽';                                          
s4='set(p,''Marker'',''s''); % 加marker';                                       
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.57,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','color','fontsize',14,'callback',...                               
    'eval(s1);set(T,''string'',s1);'); % 改颜色                                 
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.47,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','LineStyle','fontsize',14,'callback',...                           
    'eval(s2);set(T,''string'',s2);'); % 改线型                                 
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.37,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','LineWidth','fontsize',14,'callback',...                           
    'eval(s3);                                                                  
xd=get(p,'xdata');yd=get(p,'ydata');                                            
s1='set(p,''color'',''r'');  % 改颜色';                                         
s2='set(p,''LineStyle'','':'');  % 改线型';                                     
s3='set(p,''LineWidth'',2); % 改线宽';                                          
s4='set(p,''Marker'',''s''); % 加marker';                                       
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.57,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','color','fontsize',14,'callback',...                               
    'eval(s1);set(T,''string'',s1);'); % 改颜色                                 
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.47,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','LineStyle','fontsize',14,'callback',...                           
    'eval(s2);set(T,''string'',s2);'); % 改线型                                 
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.37,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','LineWidth','fontsize',14,'callback',...                           
    'eval(s3);set(T,''string'',s3);'); % 改线宽                                 
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.27,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','Marker','fontsize',14,'callback',...                              
    ['set(p,''xdata'',xd(1:6:end));',...                                        
     'set(p,''ydata'',yd(1:6:end));',...                                        
    'eval(s4);set(T,''string'',s4);']); % 加marker                              
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.17,0.19,0.07],...                     
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.47,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','LineStyle','fontsize',14,'callback',...                           
    'eval(s2);set(T,''string'',s2);'); % 改线型                                 
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.37,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','LineWidth','fontsize',14,'callback',...                           
    'eval(s3);set(T,''string'',s3);'); % 改线宽                                 
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.27,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','Marker','fontsize',14,'callback',...                              
    ['set(p,''xdata'',xd(1:6:end));',...                                        
     'set(p,''ydata'',yd(1:6:end));',...                                        
    'eval(s4);set(T,''string'',s4);']); % 加marker                              
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.17,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','recover','fontsize',14,'callback',...                             
    ['set(p,''color'',''b'');','set(p,''LineStyle'',''-'');',...                
     'set(p,''LineWidth'',0.5);','set(p,''Marker'',''none'');',...              
     'set(p,''xdata'',xd);set(p,''ydata'',yd);',...                             
     'set(T,''string'','''');']);                                               
                                                                                
T=uicontrol(gcf,'style','text',...                                              
    'unit','normalized','position',[0.1,0.8,0.79,0.07],...                      
    'string','LineWidth','fontsize',14,'callback',...                           
    'eval(s3);set(T,''string'',s3);'); % 改线宽                                 
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.27,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','Marker','fontsize',14,'callback',...                              
    ['set(p,''xdata'',xd(1:6:end));',...                                        
     'set(p,''ydata'',yd(1:6:end));',...                                        
    'eval(s4);set(T,''string'',s4);']); % 加marker                              
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.17,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','recover','fontsize',14,'callback',...                             
    ['set(p,''color'',''b'');','set(p,''LineStyle'',''-'');',...                
     'set(p,''LineWidth'',0.5);','set(p,''Marker'',''none'');',...              
     'set(p,''xdata'',xd);set(p,''ydata'',yd);',...                             
     'set(T,''string'','''');']);                                               
                                                                                
T=uicontrol(gcf,'style','text',...                                              
    'unit','normalized','position',[0.1,0.8,0.79,0.07],...                      
    'BackgroundColor',[0.9 0.9 0.9],'ForegroundColor','r',...                   
    'string','','fontsize',14);                                                 
uicontrol(gcf,'style','text',...                                                
    'unit','normalized','position',[0.1,0.88,0.17,0.07],...                     
    'BackgroundColor',[0.9 0.9 0.9],'ForegroundColor','r',...                   
    'string','语句说明:','fontsize',14);                                        
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.7,0.06,0.25,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','b',...                   
    'string','所有句柄信息','fontsize',14,'callber                              
                                                                                
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.8,0.17,0.19,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','r',...                   
    'string','recover','fontsize',14,'callback',...                             
    ['set(p,''color'',''b'');','set(p,''LineStyle'',''-'');',...                
     'set(p,''LineWidth'',0.5);','set(p,''Marker'',''none'');',...              
     'set(p,''xdata'',xd);set(p,''ydata'',yd);',...                             
     'set(T,''string'','''');']);                                               
                                                                                
T=uicontrol(gcf,'style','text',...                                              
    'unit','normalized','position',[0.1,0.8,0.79,0.07],...                      
    'BackgroundColor',[0.9 0.9 0.9],'ForegroundColor','r',...                   
    'string','','fontsize',14);                                                 
uicontrol(gcf,'style','text',...                                                
    'unit','normalized','position',[0.1,0.88,0.17,0.07],...                     
    'BackgroundColor',[0.9 0.9 0.9],'ForegroundColor','r',...                   
    'string','语句说明:','fontsize',14);                                        
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.7,0.06,0.25,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','b',...                   
    'string','所有句柄信息','fontsize',14,'callback',...                        
    ['figure(''position'',[300,0,500,700]);',...                                
        'H=uicontrol(gcf,''style'',''edit'');',...                              
        'set(H,''unit'',''normalized'');',...                                   
        'set(H,''position'',[0.1,0.1,0.8,0.9]);',...                            
        'set(H,''max'',50);',...                                                
        'set(H,''string'',Y);set(H,''fontsize'',12);',...                       
        'set(H,''HorizontalAlignment'',''center'');',...                        
        'set(H,''FontName'',''宋体'')']);                                       
P=fieldnames(S);                                                                
Y={char(P{1}),char(getfield(S,P{1}))};                                          
warning off                                                                     
A=repmat(' ',1,55);                                                             
A(30)=':';                                                                      
gf=' double]';                                                                  
for t=1:size(P,1);                                                              
    B=A;q=char(P{t});                                                           
    b=evalroundColor',[0.9 0.9 0.9],'ForegroundColor','r',...                   
    'string','语句说明:','fontsize',14);                                        
uicontrol(gcf,'style','push',...                                                
    'unit','normalized','position',[0.7,0.06,0.25,0.07],...                     
    'BackgroundColor',[0.6 0.6 0.6],'ForegroundColor','b',...                   
    'string','所有句柄信息','fontsize',14,'callback',...                        
    ['figure(''position'',[300,0,500,700]);',...                                
        'H=uicontrol(gcf,''style'',''edit'');',...                              
        'set(H,''unit'',''normalized'');',...                                   
        'set(H,''position'',[0.1,0.1,0.8,0.9]);',...                            
        'set(H,''max'',50);',...                                                
        'set(H,''string'',Y);set(H,''fontsize'',12);',...                       
        'set(H,''HorizontalAlignment'',''center'');',...                        
        'set(H,''FontName'',''宋体'')']);                                       
P=fieldnames(S);                                                                
Y={char(P{1}),char(getfield(S,P{1}))};                                          
warning off                                                                     
A=repmat(' ',1,55);                                                             
A(30)=':';                                                                      
gf=' double]';                                                                  
for t=1:size(P,1);                                                              
    B=A;q=char(P{t});                                                           
    b=eval(['S.',q]);                                                           
    B(1+29-length(q):29)=q;                                                     
    if ischar(b)                                                                
        b=['''',b,''''];                                                        
        B(33:33+length(b)-1)=b;                                                 
    else                                                                        
        if strcmp(class(b),'double')                                            
            pq=['[',num2str(size(b,1)),'x',...                                  
                    num2str(size(b,1)),' ',gf];                                 
        end                                                                     
        B(33:33+length(pq)-1)=pq;                                               
    end                                                                         
    B(8)='|';B(50)='|';                                                         
    B=deblank(fliplr(deblank(fliplr(B))));                                      
    Y{t}=B;                                                                     
end                                                                              
                                               
                                                                                 
                                                                   
    

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值