How do I turn off the LaTeX interpreter in my legend within MATLAB?

155 vues (au cours des 30 derniers jours)
I am displaying strings with underscores "_" in the legend on my plot. When the LaTex interpreter is used, the underscores are causing subscript letters. I would like to override the LaTeX interpreter so the legend appears exactly as the input string.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 18 Oct 2013
The LaTeX interpreter can be turned off for a text object by setting the 'Interpreter' property to 'none'. You can specify the interpreter to be used with the legend using the 'Interpreter' parameter/value pair input argument to the LEGEND function. For example,
figure; plot(1:10)
l = legend({'test_line'}, 'Interpreter', 'none');
Note that the legend string(s) must be enclosed in a cell array.
You can also set the 'Interpreter' property after the creation of the legend:
figure; plot(1:10)
l = legend('test_line');
set(l, 'Interpreter', 'none')

Plus de réponses (0)

Produits


Version

R13SP1

Community Treasure Hunt

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

Start Hunting!

Translated by