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

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.

 Risposta accettata

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')

Più risposte (0)

Prodotti

Release

R13SP1

Community Treasure Hunt

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

Start Hunting!

Translated by