How to align textbox in matlab plot?

5 Ansichten (letzte 30 Tage)
ANANTA BIJOY BHADRA
ANANTA BIJOY BHADRA am 19 Mär. 2024
Bearbeitet: Voss am 19 Mär. 2024
I have used tiledlayout to plot 6 figures in 3 cloumns and 2 rows. I have to use the textbox to number them from (a)-(f). Legend is lready been used as each plot has multiple graphs. Is it possible that I can put all the six textbox in the same position of the respecitve graph? I just want to make the figures easily readable.

Akzeptierte Antwort

Voss
Voss am 19 Mär. 2024
Bearbeitet: Voss am 19 Mär. 2024
"Is it possible that I can put all the six textbox in the same position of the respecitve graph?"
Yes. Here's an example that places each text object at Position [0,1] in 'normalized' Units, which is the upper-left corner of the axes.
f = figure();
tl = tiledlayout(f,2,3);
names = "("+string(char('a'+(0:5).'))+")";
for ii = 1:6
nexttile(tl)
plot(randi([1,100])*rand(1,10))
text(0,1,names(ii), ...
'Units','normalized', ...
'VerticalAlignment','bottom', ...
'FontWeight','bold')
end
  1 Kommentar
Voss
Voss am 19 Mär. 2024
Bearbeitet: Voss am 19 Mär. 2024
You could use the title function to do the same thing (if you don't already have any titles), since title creates a text object.
f = figure();
tl = tiledlayout(f,2,3);
names = "("+string(char('a'+(0:5).'))+")";
for ii = 1:6
nexttile(tl)
plot(randi([1,100])*rand(1,10))
title(names(ii), ...
'Units','normalized', ...
'Position',[0 1], ...
'VerticalAlignment','bottom', ...
'HorizontalAlignment','left', ...
'FontWeight','bold')
end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by