Have latex (bold) and variable in legend of a figure
Show older comments
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 Comments
KSSV
on 26 May 2022
What you want to display in legend?
Miraboreasu
on 26 May 2022
Edited: Miraboreasu
on 26 May 2022
Accepted Answer
More Answers (1)
Sam Chak
on 26 May 2022
Hi @Miraboreasu
I think this should work:
legend({'$\left[\frac{t v_{p}}{r_{well}}\right] \left(\Pi_{1}\right)$'}, 'Interpreter', 'latex', 'location', 'best')
1 Comment
Miraboreasu
on 27 May 2022
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
