目录
1.Matlab用plot函数绘图案例
%% sec交叉验证
clc;clear all;close all;
p=[1.72,0.27,2.4,0.17,2.24,0.24;
2.,0.30,2.8,0.17,2.4,0.2;
2.1,0.3,2.8,0.2,2.8,0.29;
2.4,0.34,3.27,0.24,3.27,0.31;
2.64,0.37,3.29,0.2,3.6,0.35];
figure(1)
plot(1:size(p,1),p(:,1),'-r^','linewidth',1.5) %NO21
hold on;
plot(1:size(p,1),p(:,3),'-bd','linewidth',1.5) %NO21
hold on;
plot(1:size(p,1),p(:,5),'-go','linewidth',1.5,'color','#00ad7c') %NO21
hold on;
ylim([0 6])
ylim([0 5])
set(gca,'XTick',[0:1:5])
legend('BP','SVM','RF','Orientation','horizontal','position',[0.5 0.3 0 0]) %
lgd=legend;
lgd.Title.String = '图例标题';
xlabel('迭代次数')
ylabel('MAE')
set(gcf,'position',[0 650 500 250]); %前两个是屏幕显示位置 后两个是画布大小
box off
ax2 = axes('Position',get(gca,'Position'),...
'Color','none',...
'XAxisLocation','top',...
'YAxisLocation','right',...
'XColor','k','YColor','k');
set(ax2,'YTick', []);
set(ax2,'XTick', []);
2.Matlab用plot函数绘图总结