How can I write different subscription font type of label?

5 ビュー (過去 30 日間)
JunYoung Noh
JunYoung Noh 2019 年 12 月 19 日
コメント済み: Patrick Laux 2020 年 7 月 16 日
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?

採用された回答

Lucademicus
Lucademicus 2019 年 12 月 19 日
編集済み: Lucademicus 2019 年 12 月 20 日
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 件のコメント
JunYoung Noh
JunYoung Noh 2019 年 12 月 19 日
I mean different font type. Sorry for confusing
Lucademicus
Lucademicus 2019 年 12 月 20 日
I've editted my answer and included screenshots. Lowercase \phi is italic.

サインインしてコメントする。

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2019 年 12 月 20 日
編集済み: Walter Roberson 2019 年 12 月 20 日

Patrick Laux
Patrick Laux 2020 年 7 月 16 日
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 件のコメント
Patrick Laux
Patrick Laux 2020 年 7 月 16 日
ah okay, I found it:
you have to specifiy latex interpreter
set(gca,'TickLabelInterpreter', 'tex');

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by