一、plot使用脚本
常规设置
1.线型+颜色+宽度
2.legend 字体+字号+位置
3.label 字体+字号
4.title 字体+字号+加粗
5.gca 边框宽度+坐标轴字体+坐标轴范围+网格
6.设置fig大小
x=linspace(0,2*pi,100);
y1=sin(x);
y2=cos(x);
fig=figure;
set(fig, 'Position', [1000, 600, 900, 600])
plot(x,y1,'-g','LineWidth',3); hold on;
plot(x,y2,'--r','LineWidth',3); hold off;
legend('y1','y2','FontName','Times New Roman','FontSize',20,'Location','northeast');
xlabel('x','FontName','Times New Roman','FontSize',30);
ylabel('y','FontName','Times New Roman','FontSize',30);
title("Test",'FontName','Times New Roman','FontSize',34,'FontWeight','bold');
xlim([0 7]);
ylim([-1.1 1.1]);
set(gca,'fontsize',24,'fontname','Times New Roman','LineWidth',2);
grid on;
二、pcolor使用脚本(绘制伪彩图)
常规设置
shading interp: 色彩平滑过度(未平滑时每个值可视为单独的像素,每个像素均含有边框)
x=linspace(0,2*pi,50);
y=linspace(0,2*pi,50);
z=sin(x);
z_matrix=zeros(50,50);
for i=1:50
z_matrix(i,:)=z;
end
pcolor(x,y,z_matrix); % 调用pcolor
shading interp;
三、subplot使用脚本
常规设置
1.subplot 分区绘图
2.text 对图片进行标号(a) (b) ©…
% 生成数据
x=linspace(0,2*pi,50);
y=linspace(0,2*pi,50);
z=sin(x);
z_matrix=zeros(50,50);
for i=1:50
z_matrix(i,:)=z;
end
% 调用subplot
subplot(2,2,[1 2]);
plot(x,z);
text(-0.5,1.2,"(a)",'FontName','Times New Roman','FontSize',20);
subplot(2,2,3)
pcolor(x,y,z_matrix); % 无shading interp
text(-1,2*pi+1,"(b)",'FontName','Times New Roman','FontSize',20);
subplot(2,2,4)
pcolor(x,y,z_matrix);
shading interp;
text(-1,2*pi+1,"(c)",'FontName','Times New Roman','FontSize',20);