Multiple text entries over plots
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Roderick
am 14 Aug. 2024
Kommentiert: Stephen23
am 14 Aug. 2024
Dear all
Currently, I am plotting the following:
u1=figure('visible','off','units','pixels','position',[0 0 1920 1080]);
t=tiledlayout("vertical");
title(t,strcat(['Exfoliated hexalayer. First layer. LLG-Heun, $t=\, \,$',num2str(time(m)),'',time_text{m},', $\alpha=\, \,$',num2str(damping(1)),'. $T=\, \,$',num2str(round(temperature(m),2)),' K, $\mathbf{H}=0$';'';'']),'FontSize',18,'interpreter','latex');
nexttile;
uimagesc(space_x,space_y,mx_1(:,:,m));
hold on
plot(geometry_tetra(:,1),geometry_tetra(:,2),'-k','LineWidth',0.5);
plot(geometry_penta(:,1),geometry_penta(:,2),'-k','LineWidth',0.5);
plot(geometry_hexa(:,1),geometry_hexa(:,2),'-k','LineWidth',0.5);
hold off
axis xy;
clim([-1 1]);
colormap(bluewhitered(256));
box on;
xlim([0 x]);
xticks([0:50:200]);
ylim([0 y]);
yticks([0:19:95]);
pbaspect([x/y 1 1]);
xtickangle(0);
set(gca,'TickLabelInterpreter','latex','FontSize',18);
t1=title(['$m_a$'],'FontSize',20,'interpreter','latex');
set(t1,'interpreter','latex','FontSize',20);
set(gca,'XTickLabel',[]);
yticks([0:19:95]);
nexttile;
uimagesc(space_x,space_y,my_1(:,:,m));
hold on
plot(geometry_tetra(:,1),geometry_tetra(:,2),'-k','LineWidth',0.5);
plot(geometry_penta(:,1),geometry_penta(:,2),'-k','LineWidth',0.5);
plot(geometry_hexa(:,1),geometry_hexa(:,2),'-k','LineWidth',0.5);
hold off
clim([-1 1]);
colormap(bluewhitered(256));
axis xy;
box on;
clr2=colorbar;
set(clr2,'TickLabelInterpreter','latex');
ylabel(t,'$b$-{\it th} spatial direction, $b \, \, \left( \mathrm{nm} \right)$','FontSize',18,'interpreter','latex');
ylabel(clr2,'$i$-{\it th} magnetization component, $m_i$','Interpreter','Latex','FontSize',19);
clr2.Layout.Tile='east';
xlim([0 x]);
xticks([0:50:200]);
ylim([0 y]);
yticks([0:19:95]);
pbaspect([x/y 1 1]);
xtickangle(0);
set(gca,'TickLabelInterpreter','latex','FontSize',18);
t2=title(['$m_b$'],'FontSize',20,'interpreter','latex');
set(t2,'interpreter','latex','FontSize',20);
set(gca,'XTickLabel',[]);
yticks([0:19:95]);
nexttile;
uimagesc(space_x,space_y,mz_1(:,:,m));
hold on
plot(geometry_tetra(:,1),geometry_tetra(:,2),'-k','LineWidth',0.5);
plot(geometry_penta(:,1),geometry_penta(:,2),'-k','LineWidth',0.5);
plot(geometry_hexa(:,1),geometry_hexa(:,2),'-k','LineWidth',0.5);
hold off
box on;
axis xy;
clim([-1 1]);
colormap(bluewhitered(256));
xlabel('$a$-{\it th} spatial direction, $a \, \, \left( \mathrm{nm} \right)$','FontSize',18,'interpreter','latex');
xlim([0 x]);
xticks([0:50:200]);
ylim([0 y]);
yticks([0:19:95]);
pbaspect([x/y 1 1]);
xtickangle(0);
set(gca,'TickLabelInterpreter','latex','FontSize',18);
t3=title(['$m_z$'],'FontSize',20,'interpreter','latex');
set(t3,'interpreter','latex','FontSize',20);
yticks([0:19:95]);
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)]);
which gives:
I need to add some text entries, in LaTeX format, in such a way that the figure looks like:
Is there any good strategy to select the position of the 4L, 5L, and 6L so the text entries are more less centered within the definition region?
0 Kommentare
Akzeptierte Antwort
KSSV
am 14 Aug. 2024
You can use the text to add the strings. You need to specify the position where you want to place the string. You may find centroids o the closed region/ polygons and place the text there.
2 Kommentare
Stephen23
am 14 Aug. 2024
" Is there any way, using text, to specify that text string should be centered at the given set of points, instead of being used as the left bottom position of the aforementioned text?"
Specify the horizontal and vertical alignment:
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!