How can I colour in different colours 2 rows of ylabel using Latex as interpreter?

28 visualizzazioni (ultimi 30 giorni)
I wrote this line :
ylabel({'$\tilde{\mu}_c$','$\tilde{\mu}_o$'},'Interpreter', 'Latex','Rotation',0,'Position',[-0.1,0.5,0],'FontSize',15)
as ylabel but I wanted to colour in red '$\tilde{\mu}_c$' and in blue '$\tilde{\mu}_o$' using Latex as interpreter (because I need it to put the tilde on the mu symbol ).
thank you for helping me
  5 Commenti
Camilla Ancona
Camilla Ancona il 20 Apr 2020
Modificato: Camilla Ancona il 20 Apr 2020
ok, thank you a lot for putting so much effort in searching a solution for me. I appreciate that :)
dpb
dpb il 20 Apr 2020
Wish had better news to report. LaTeX is (one of) the lesser-class citizens in the MATLAB stable for sure.

Accedi per commentare.

Risposta accettata

dpb
dpb il 20 Apr 2020
Modificato: dpb il 20 Apr 2020
Well, it finally dawned on me how to work around your particular wish...
hTxt(1,1)=text(-0.1,0.55,{'$\tilde{\mu}_c$'},'Interpreter', 'Latex','Rotation',0,'FontSize',15,'color','r');
hTxt(2,1)=text(-0.1,0.45,{'$\tilde{\mu}_o$'},'Interpreter', 'Latex','Rotation',0,'FontSize',15,'color','b');
results in
May want to fiddle with position a little, but gets the characters wanted in the colors wanted.
So, somehow the LaTeX engine is told the color, but can't figure out how to do it other than globally for the string. This produces two objects instead of just the one via legend so can fixup them individually.
  2 Commenti
dpb
dpb il 20 Apr 2020
Yeah, it's easy to get fixated on how to make one deadend path work to the point don't think about alternatives...but I agree it surely seems there ought to be a way to do what asked originally if TMW is going to support the 'LaTeX' interpreter property at all. If do, then ought to document how to use their encapsulation inside their product. Been this way 30 years. :(

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Historical Contests in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by