フィルターのクリア

How to align textbox in matlab plot?

8 ビュー (過去 30 日間)
ANANTA BIJOY BHADRA
ANANTA BIJOY BHADRA 2024 年 3 月 19 日
編集済み: Voss 2024 年 3 月 19 日
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.

採用された回答

Voss
Voss 2024 年 3 月 19 日
編集済み: Voss 2024 年 3 月 19 日
"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 件のコメント
Voss
Voss 2024 年 3 月 19 日
編集済み: Voss 2024 年 3 月 19 日
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

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by