Misalignment plot with several axes
显示 更早的评论
Dear all,
I have the following code that gives me a group of subplots.
for k = 1:N
CellSELpercentil{k} = eval(string(SELtimepercentil(k)));
M=CellSELpercentil{k};
ax1=axes;
subplot(2,3,k,ax1);
imagesc(ax1,km2deg(Xv),km2deg(Yv),M);
h=colorbar(ax1,'southoutside');
ylabel(h,'Sound Exposure Level (dB)');
set(gca,'YDir','normal');
clear title
title(strcat('SEL\_', listofpercentis(k)));
xlabel('LONGITUDE');
ylabel('LATITUDE');
axis tight;
clear title
ax2=axes;
subplot(2,3,k,ax2);
contourf(ax2,km2deg(lon_km),km2deg(lat_km),elevation', [-5 -5],'w','facecolor','w');
ax3=axes;
subplot(2,3,k,ax3);
c2=contourf(ax3,km2deg(lon_km),km2deg(lat_km),elevation', [0 0],'facecolor',[0.5 0.5 0.5]);
linkaxes([ax1,ax2,ax3]);
ax2.Visible = 'off';
ax2.XTick = [];
ax2.YTick = [];
ax3.Visible = 'off';
ax3.XTick = [];
ax3.YTick = [];
ax2.Visible = 'on';
ax2.Visible = 'off';
ax3.Visible = 'on';
ax3.Visible = 'off';
axes(ax1); axis equal;
axes(ax2); axis equal;
axes(ax3); axis equal;
hold on;
ax1.XGrid = 'on';
ax1.YGrid = 'on';
ax1.GridColor = [1, 1, 1]; % [R, G, B]
hold on; contourf(km2deg(lon_km),km2deg(lat_km),elevation', [-50 -50],'w','ShowText','on','facecolor','none'); %linha dos 50m
hold on; contourf(km2deg(lon_km),km2deg(lat_km),elevation', [-100 -100],'w','ShowText','on','facecolor','none'); %linha dos 100m
hold on; contourf(km2deg(lon_km),km2deg(lat_km),elevation', [-250 -250],'w','ShowText','on','facecolor','none'); %linha dos 250m
hold on; contourf(km2deg(lon_km),km2deg(lat_km),elevation', [-1000 -1000],'w','ShowText','on','facecolor','none'); %linha dos 1000m
portugal=text(deg2km(-8.6),deg2km(38.3),'Portugal','FontSize',20); %Portugal Setubal
set(portugal,'Rotation',90);
setubal=text(deg2km(-9.0),deg2km(38.55),'Setubal','FontSize',14); %Portugal Sines
caxis(ax1,[120 180]);
hold off
end
set(gcf,'WindowState','maximized')
However everything works fine, but when I had the colorbar (line 8) the axis kind of get displaced and I get the following plots.

Do you have any idea of how to get it working properly?
Thank you in advance
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Graphics Performance 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
