针对已经绘制好的figure,如何修改曲线的属性,如颜色、线性、标记符号?
思路:首先选中目标属性,调用句柄来逐级选择,即 figure – axis – line ;
具体程序如下:
set(0,'defaultfigurecolor','w');%设置图片默认背景为白色 h_f=gcf;%选中当前图片句柄 h_a=gca;%选中坐标轴句柄 h_lines=get(h_a,'Children');%选中曲线句柄 set(h_lines(1,1),'LineStyle','-.','Color',[0 0 1],'LineWidth',1.5,'Marker','o','MarkerSize',10.0,'MarkerFaceColor','none','MarkerEdgeColor',[0 0 1],'MarkerIndices',1:5:500);%设置曲线3的属性 set(h_lines(2,1),'LineStyle','-','Color',[25 141 25]/255,'LineWidth',1.5,'Marker','^','MarkerSize',10.0,'MarkerFaceColor','none','MarkerEdgeColor',[25 141 25]/255,'MarkerIndices',1:5:500);%设置曲线2的属性 set(h_lines(3,1),'LineStyle','--','Color',[1 0 0],'LineWidth',1.5,'Marker','p','MarkerSize',10.0,'MarkerFaceColor','none','MarkerEdgeColor',[1 0 0],'MarkerIndices',1:5:500);%设置曲线1的属性 set(gca,'XTick',0:500:2000,'YTick',0:0.2:1,'FontSize',28,'FontName','Arial');%设置坐标轴取值范围 xlabel('Time (units of \tau)','FontName','Euclid','FontSize',36,'FontWeight','Bold');%设置x轴标签 ylabel('Intensity {\itf} ^2 ({\ita}. {\itu}.)','FontName','Euclid','FontSize',36,'FontWeight','Bold');%设置y轴标签 axis([0 2000 -0.05 1.05]);%设置坐标轴取值范围 lgd1=legend({'\Omega_{\itp}','\Omega_{\itc}/\Omega_{0}','\theta'},'Location','Northeast','FontSize',28,'FontName','Euclid','TextColor','black');%设置图例 legend('boxon');%设置图例边框-打开 grid on;%打开网格线