Have latex (bold) and variable in legend of a figure

22 ビュー (過去 30 日間)
Miraboreasu
Miraboreasu 2022 年 5 月 26 日
コメント済み: Miraboreasu 2022 年 5 月 27 日
Hello,
I have two lines in one figure, one is called error, and the other is typed by latex form as well as the first element of array ```x```, but I tried to use sprintf, but the results are wierd
```
x=[1.1, 2.1, 3.1]
legend( 'Error',sprintf('\bf[$\bf\frac{t v_p}{r_{well}}$] (\bf$\Pi_1$) = %f', x(1)), 'Location','best','Interpreter','latex' )
```
  2 件のコメント
KSSV
KSSV 2022 年 5 月 26 日
What you want to display in legend?
Miraboreasu
Miraboreasu 2022 年 5 月 26 日
編集済み: Miraboreasu 2022 年 5 月 26 日
Hello, you mean what is this latex for?
this, thank you

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

採用された回答

KSSV
KSSV 2022 年 5 月 26 日
編集済み: KSSV 2022 年 5 月 26 日
plot(rand(1,10)) ;
hold on
plot(rand(1,10)) ;
legend( 'Error','$[\frac{tv_p}{r_{well}}](\Pi_1=)$','Interpreter','latex', 'Location','best')
set(gca,'FontSize',24)
  3 件のコメント
KSSV
KSSV 2022 年 5 月 27 日
plot(rand(1,10)) ;
hold on
plot(rand(1,10)) ;
legend( '\bf Error','$\bf [\frac{tv_p}{r_{well}}](\Pi_1=)$','Interpreter','latex', 'Location','best')
set(gca,'FontSize',24)
Miraboreasu
Miraboreasu 2022 年 5 月 27 日
Thank you, but how to use the element from my array ```x```

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

その他の回答 (1 件)

Sam Chak
Sam Chak 2022 年 5 月 26 日
I think this should work:
legend({'$\left[\frac{t v_{p}}{r_{well}}\right] \left(\Pi_{1}\right)$'}, 'Interpreter', 'latex', 'location', 'best')
  1 件のコメント
Miraboreasu
Miraboreasu 2022 年 5 月 27 日
How to make the font bold

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

カテゴリ

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

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by