How to insert variable in multi-line, multi-font title?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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,
0 comentarios
Respuestas (1)
Walter Roberson
el 8 de Feb. de 2014
title({['\fontsize{14}', AirfoilName];'\fontsize{10}\color{blue} ';...
'Coefficient of Lift';'vs Angle of Attack'},'fontweight','b');
2 comentarios
Chase
el 18 de Mzo. de 2015
How would you do the same, but while using:
'Interpreter','none'
?
Stephen23
el 18 de Mzo. de 2015
Editada: Stephen23
el 18 de Mzo. de 2015
@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 \^.
Ver también
Categorías
Más información sobre Axis Labels en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!