Filter löschen
Filter löschen

how to add a subscript in colour map labels

2 Ansichten (letzte 30 Tage)
MS
MS am 8 Mai 2020
Bearbeitet: Cris LaPierre am 8 Mai 2020
How to add a subscript to a text(Uo) in matlab 2020a. Please help me to write a subscript to colour map label.
h.Label.String = 'ωc/U_{0}';% not the right way
  2 Kommentare
Ameer Hamza
Ameer Hamza am 8 Mai 2020
This code seems to work fine. I am usin R2020a. Can you show what is the output on your system?
MS
MS am 8 Mai 2020
you are correct ameer. It only works without LaTex interpreter. Kindly let me know if you know the solution to work with LaTex interpreter.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 8 Mai 2020
Bearbeitet: Cris LaPierre am 8 Mai 2020
The interpreter in app designer only works for figure objects (title, labels, text, legend). See this post for possible workarounds for other components.
  3 Kommentare
Cris LaPierre
Cris LaPierre am 8 Mai 2020
Bearbeitet: Cris LaPierre am 8 Mai 2020
I think the issue here is you have a greek symbol already in your string (omega). This appears to be messing up the interpreter. You have two options. To subscript in a colorbar label, you don't need to specify an interpreter. Try doing just this:
h.Label.String = 'ωcU_{0}';
If instead you want to use the latex interpreter, you have to provide valid LaTeX code enclosed in "$":
h.Label.Interpreter = 'latex';
h.Label.String = '$\omega c/U_{0}$';
MS
MS am 8 Mai 2020
Thanks, it worked for me.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by