How do I turn off the LaTeX interpreter in my legend within MATLAB?
663 views (last 30 days)
Show older comments
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.
Accepted Answer
MathWorks Support Team
on 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')
0 Comments
More Answers (0)
See Also
Categories
Find more on Legend 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!