How to use Greek letters and subscripts in a GUI?
6 views (last 30 days)
Show older comments
Glenn van Vugt
on 21 Nov 2018
Edited: Cris LaPierre
on 24 Nov 2018
How to use Greek letters and subscripts in a GUI.
Using the code that works for a figure plot doesn't seem to work. I'm using the R2018a version.
0 Comments
Accepted Answer
Cris LaPierre
on 21 Nov 2018
Edited: Cris LaPierre
on 24 Nov 2018
If you are using App Designer, you need to set the interpreter to 'TeX' or 'LaTeX'. Unfortunately, only TickLabelInterpreter is available through the interface. To set other items, you need to do the following:
% For UIAxes Title, XLabel, or YLabel, this can only be accomplished programatically.
% That means you must set the interpreter and string in code - perhaps the startupFcn Callback
app.UIAxes.Title.Interpreter = 'latex';
app.UIAxes.Title.String = '$\int_{0}^{2} x^3\sin(x) dx$';
% For text objects:
text(app.UIAxes,0.5,0.5,'$\int_{0}^{2} x^3\sin(x) dx$','Interpreter','latex');
% For colorbar:
c = colorbar(app.UIAxes);
c.Label.Interpreter = 'latex';
c.Label.String = '$\int_{0}^{2} x^3\sin(x) dx$';
% For legend:
h = legend(app.UIAxes);
title(h,'$\int_{0}^{2} x^3\sin(x) dx$','Interpreter','latex');
All other components do not yet support interpreters (in 2018a).
0 Comments
More Answers (0)
See Also
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!