Equally spaced figures in tiledlayout environment
Afficher commentaires plus anciens
Hello everyone
I have generated the following image through the tiledlayout environment:

which I have generated through the following code:
u1=figure('visible','off','units','pixels','position',[0 0 1920 1080]);
tiledlayout("horizontal");
nexttile;
uimagesc(x,y,modulus');
axis xy;
hold off;
colormap;
box on;
clr1=colorbar;
set(clr1,'TickLabelInterpreter','latex');
xlabel('$x$-{\it th} spatial direction, $x$','FontSize',18,'interpreter','latex');
ylabel('$y$-{\it th} spatial direction, $y$','FontSize',18,'interpreter','latex');
ylabel(clr1,'Modulus, $\mathbf{H}$','Interpreter','Latex','FontSize',19);
clim([0 max(max(abs(modulus)))]);
xlim([0 50]);
xticks([0:10:50]);
ylim([0 50]);
yticks([0:10:50]);
pbaspect([1 1 1]);
set(gca,'TickLabelInterpreter','latex','FontSize',18);
nexttile;
image(angular_distribution);
hold off;
axis xy;
box on;
xlabel('$x$-{\it th} spatial direction, $x$','FontSize',18,'interpreter','latex');
ylabel('$y$-{\it th} spatial direction, $y$','FontSize',18,'interpreter','latex');
xlim([0 1000]);
xticks([0:200:1000]);
xticklabels({'0','10','20','30','40','50'});
ylim([0 1000]);
yticks([0:200:1000]);
yticklabels({'0','10','20','30','40','50'});
pbaspect([1 1 1]);
set(gca,'TickLabelInterpreter','latex','FontSize',18);
t1=title(['First case'],'FontSize',25,'interpreter','latex');
titleHandle=get(gca,'Title');
position_title=get(titleHandle,'position');
position1_title=[position_title(1) position_title(2)+420 position_title(3)];
set(titleHandle,'position',position1_title);
ax=nexttile;
image(angular_reference,'xdata',phi_range,'ydata',theta_range)
hold off;
box on;
axis xy;
xlabel('Azimuthal angle, $\phi \, \, \left( \pi \, \mathrm{rad} \right)$','FontSize',18,'interpreter','latex');
ylabel('Polar angle, $\theta \, \, \left( \pi \, \mathrm{rad} \right)$','FontSize',18,'interpreter','latex');
xlim([-pi pi]);
xticks([-pi:pi/2:pi]);
set(gca,'XTickLabel',{'-1','0.5','0','0.5','1'});
ylim([-pi/2 pi/2]);
yticks([-pi/2:pi/4:pi/2]);
set(gca,'YTickLabel',{'-0.5','0.25','0','0.25','0.5'});
xtickangle(ax,0);
ytickangle(ax,0);
pbaspect([1 1 1]);
set(gca,'TickLabelInterpreter','latex','FontSize',18);
set(gcf,'color','white');
set(gca,'Units','normalized')
set(u1,'Units','Inches');
posu1=get(u1,'Position');
set(u1,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[posu1(3),posu1(4)]);
As it can be seen, the empty space between the right end of the colorbar of the first figure and the beginning of the second figure, and the spacing between the right end of the second and left of the third figure are not equal. It seems that there is a kind of invisible colorbar accompanying the second figure. How could I make the figures truly equally spaced?
1 commentaire
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Axes Appearance dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



