Specify bold text in legend directly in the Line command

42 ビュー (過去 30 日間)
Thomas
Thomas 2025 年 10 月 10 日 7:43
コメント済み: Thomas 2025 年 10 月 13 日 9:00
Hi
I usually send the legend text, for a Line with 'DisplayName', when I plot it, see example below.
I am looking for a way to specify that the legend associated to the plot should be bold.
I am aware of the FontWeight property for the Legend class, but this is not what I am looking for. I would like to specify it in the plot command.
I would appreciate it if someone could give an example of how to do this!
figure
hold on
legend('show')
x=linspace(0,1,101);
y=x.^2;
plot(x,y,'DisplayName','My Parabola')
hold on

採用された回答

Walter Roberson
Walter Roberson 2025 年 10 月 10 日 16:48
x=linspace(0,1,101);
y=x.^2;
plot(x,y,'DisplayName','\bf{My Parabola}')
legend show
  1 件のコメント
Thomas
Thomas 2025 年 10 月 13 日 9:00
Thanks for reply. This is what I am looking for.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by