话不多说,直接上图:(有需要的小伙伴直接微信搜索公众号:“XD悟理”,后台回复“复现1”就可以得到完整的代码)
% 绘图操作
figure(1)
subplot(2,2,1)
pcolor(x,y,normalizeI);
set(gca,'fontname','times new roman','fontsize',10);
clim([0,1]);
shading interp;
colormap hot;
colorbar;
% figure(2)
subplot(2,2,2)
pcolor(x,y,I_Er);
set(gca,'fontname','times new roman','fontsize',10);
xlabel('\itx(\rm\lambda)','fontname','times new roman','fontsize',15); %x方向标注
ylabel('\ity(\rm\lambda)','fontname','times new roman','fontsize',15); %y方向标注
axis([Xmin,Xmax,Ymin,Ymax]); %区间范围
set(gca,'YTick',Xmin:Tickx:Xmax,'XTicklabel',{-2:1:2});
set(gca,'XTick',Ymin:Ticky:Ymax,'YTicklabel',{-2:1:2});
clim([0,1]);
shading interp;
colormap hot;
colorbar;
subplot(2,2,3)
pcolor(x,y,I_Ep);
set(gca,'fontname','times new roman','fontsize',10);
xlabel('\itx(\rm\lambda)','fontname','times new roman','fontsize',15); %x方向标注
ylabel('\ity(\rm\lambda)','fontname','times new roman','fontsize',15); %y方向标注
axis([Xmin,Xmax,Ymin,Ymax]); %区间范围
set(gca,'YTick',Xmin:Tickx:Xmax,'XTicklabel',{-2:1:2});
set(gca,'XTick',Ymin:Ticky:Ymax,'YTicklabel',{-2:1:2});
clim([0,1]);
shading interp;
colormap hot;
colorbar;
% figure(3)
subplot(2,2,4)
h=plot(x(1,:),I_Ez(:,(size(I_Ez,1)+1)/2),x(1,:),I_Er(:,(size(I_Er,1)+1)/2),x(1,:),I_Ep(:,(size(I_Ep,1)+1)/2));
legend('|E_z|^{2}','|E_r|^{2}','|E_p|^{2}');
% 修改线形
h(1).Color = 'r'; %这里说明修改的颜色蓝色,可以使用RGB三原色
h(2).Color = '0 0.4470 0.7410';
h(3).Color = '0.4940 0.1840 0.5560';
h(1).LineWidth = 1.2;h(2).LineWidth = 1.2;h(3).LineWidth = 1.2;
h(1).Marker = 'hexagram';h(2).Marker = '*';h(3).Marker = 'o';
h(1).MarkerSize = 0.8;
h(2).MarkerSize = 3;
h(3).MarkerSize = 3;
ax = gca; %获得坐标轴的属性
ax.XLim = [Xmin,Xmax];
% ax.YLim = [-3,3];
ax.XTick = Xmin:Tickx:Xmax;
% ax.YTick = -2:1:2;
ax.XTickLabel = -2:1:2;
% ax.YTickLabel = -2:1:2;
ax.FontSize = 12;
ax.LineWidth = 1.0;
ax.XColor = '0 0 0';
ax.YColor = '0 0 0';
ax.FontName = 'times new roman';
ax.XLabel.String = '\itx(\rm\lambda)';
ax.XLabel.FontSize = 15;
ax.YLabel.String = 'Normalized intensity component';
ax.YLabel.FontSize = 15;
ax.Legend.Box = 'off';
ax.Legend.FontName = 'times new roman';
ax.Legend.Location = 'northwest';
ax.Legend.FontSize = 15;
ax.Color = [1 1 1];