Borrar filtros
Borrar filtros

How to align textbox in matlab plot?

8 visualizaciones (últimos 30 días)
ANANTA BIJOY BHADRA
ANANTA BIJOY BHADRA el 19 de Mzo. de 2024
Editada: Voss el 19 de Mzo. de 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.

Respuesta aceptada

Voss
Voss el 19 de Mzo. de 2024
Editada: Voss el 19 de Mzo. de 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 comentario
Voss
Voss el 19 de Mzo. de 2024
Editada: Voss el 19 de Mzo. de 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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by