Filter löschen
Filter löschen

How can I write different subscription font type of label?

7 Ansichten (letzte 30 Tage)
Like figure below, I want to write phi and CH4 for diffrent font type.
(phi should be Italic but CH4 should not. & CH4 must be a subscription of phi)
How can i do this?

Akzeptierte Antwort

Lucademicus
Lucademicus am 19 Dez. 2019
Bearbeitet: Lucademicus am 20 Dez. 2019
You can achieve that by using a underscore _, following what you'd want subscripted. You can group something by placing it within curly brackets.
In this case:
xlabel('\phi_{CH_4}')
phiCH4.png
If you want a longer subscript, you should place that subscript also within curly brackets:
xlabel('\phi_{D_{solid}}')
Dsolid.png
  2 Kommentare
JunYoung Noh
JunYoung Noh am 19 Dez. 2019
I mean different font type. Sorry for confusing
Lucademicus
Lucademicus am 20 Dez. 2019
I've editted my answer and included screenshots. Lowercase \phi is italic.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Walter Roberson
Walter Roberson am 20 Dez. 2019
Bearbeitet: Walter Roberson am 20 Dez. 2019

Patrick Laux
Patrick Laux am 16 Jul. 2020
Hi,
interestingly, subscripting does not work in combination with the boxplot function.
Any help appreciated.
A=rand(100,1)
boxplot(A)
set(gca, 'XTickLabel', {'test_{hey}'})
  1 Kommentar
Patrick Laux
Patrick Laux am 16 Jul. 2020
ah okay, I found it:
you have to specifiy latex interpreter
set(gca,'TickLabelInterpreter', 'tex');

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots 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