% 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
ezplot中如何给曲线加颜色和函数名zz
最新推荐文章于 2023-08-29 22:39:13 发布