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 CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by