How to insert variable in multi-line, multi-font title?

조회 수: 3 (최근 30일)
lily
lily 2014년 2월 7일
편집: Stephen23 2015년 3월 18일
Hi,
I'm trying to insert a variable into a plot title, but the variable needs to have a different font and size to the rest of the text.
What I have now is
title({'\fontsize{14}AirfoilName';'\fontsize{10}\color{blue} ';...
'Coefficient of Lift';'vs Angle of Attack'},'fontweight','b');
This would work - except AirfoilName is a variable.
All I can find that may work are int2str(x), but this variable is already text.
My ultimate aim is a title on a figure which contains subplots. I can't get 'annotation('textbox'..)' or 'text' to work, so I gave up. I've also seen reference to something like 'suptit', but I've also seen reference to it being a dodgy file (or maybe it was just the one link?). I therefore gave up on that and was trying to do it in a subplot title instead.
Thanks,

답변 (1개)

Walter Roberson
Walter Roberson 2014년 2월 8일
title({['\fontsize{14}', AirfoilName];'\fontsize{10}\color{blue} ';...
'Coefficient of Lift';'vs Angle of Attack'},'fontweight','b');
  댓글 수: 2
Chase
Chase 2015년 3월 18일
How would you do the same, but while using:
'Interpreter','none'
?
Stephen23
Stephen23 2015년 3월 18일
편집: Stephen23 2015년 3월 18일
@Chase: Markup is the name given to meta-information given in some text that controls how it will be displayed. When the text property Interpreter is set to none then there is no interpretation at all of these commands, so changes in color or font are not possible.
Walter Roberson's answer uses the default TeX syntax: any text that you can display as plain text can also be displayed using TeX, so there is no reason why you cannot use the method given by Walter Roberson.
Do you have some specific text that you wish to display? The properties documentation includes a list of TeX commands that you can use. Note that you can get an underscore character _ by entering \_, and a circumflex character ^ by entering \^.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by