【发布时间】:2020-04-07 17:39:55
【问题描述】:
通过在循环中绘制每条曲线与the previous question中自己存储的数据(即方法)相关的曲线,如何更改和定义新的特定颜色和线型(例如“--” ) 循环后每个方法的曲线?
figure
hold on
for m = 1:length(methods)
prFileName = strcat(readpath,dataset, '_', methods{m}, '_PRCurve.txt');
R = load(prFileName);
precision = R(:, 1);
recall = R(:, 2);
plot(recall, precision,'color',methods_colors(m,:),'linewidth',2);
end
axis([0 1 0 1]);
hold off
grid on;
box on;
legend('methode one','method two')
xlabel('Recall','fontsize',12);
ylabel('Precision','fontsize',12);
set(gcf,'color','w'); %Background color
ax = gca; % current axes
ax.GridLineStyle='-';
ax.GridAlpha=0.7;
ax.XAxis.LineWidth=4;
ax.YAxis.LineWidth=4;
Grid.LineWidth = 3;
set(gca,'FontName','Arial','FontWeight','bold');
为了方便实现,每个方法的数据可以假设为
rand(256x2)。
【问题讨论】:
-
您可以遍历坐标区对象的所有“子对象”以找到绘图对象,并从那里设置它们的“颜色”
标签: matlab for-loop matlab-figure