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 Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by