Fractions inside a legend

Hi , i am trying to write a fraction 1/3 in a legend.
Please see my attemtp and the resulting legend. please help
legend('External Force','Net Force', '$F = \frac{1}{3}$','Interpreter','latex')

6 comentarios

madhan ravi
madhan ravi el 7 de Abr. de 2019
It worked fine for me in 2018 b version , which release are you using?
Vincent Kavanagh
Vincent Kavanagh el 7 de Abr. de 2019
MATLAB Version: 9.3.0.713579 (R2017b)
MATLAB License Number: 31
Operating System: Mac OS X Version: 10.13.6 Build: 17G5019
Java Version: Java 1.8.0_121-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed
Star Strider
Star Strider el 7 de Abr. de 2019
It worked for me as well (R2019a).
Try this:
hl = legend('External Force','Net Force', '$F = \frac{1}{3}$');
set(hl ,'Interpreter','latex')
Vincent Kavanagh
Vincent Kavanagh el 7 de Abr. de 2019
worked perfectly thank you very much
Star Strider
Star Strider el 7 de Abr. de 2019
My pleasure.
Vincent Kavanagh
Vincent Kavanagh el 7 de Abr. de 2019
actually 1 more question...if i want to make it - 1/3 what do i do ?

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 7 de Abr. de 2019

1 voto

To put a negative sign in front of it, do this:
hl = legend('External Force','Net Force', '$F = -\frac{1}{3}$');
set(hl ,'Interpreter','latex')
If I understand correctly what you want to do.

2 comentarios

Vincent Kavanagh
Vincent Kavanagh el 7 de Abr. de 2019
Thanks again
Star Strider
Star Strider el 7 de Abr. de 2019
My pleasure.

Iniciar sesión para comentar.

Preguntada:

el 7 de Abr. de 2019

Comentada:

el 7 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by