How do I get my legend entry to have an underscore in the name without MATLAB thinking I want the underscore to mean subscript?
One option, if you don't intend to use any TeX or LaTeX formatting for your legend strings, is to set the 'Interpreter'
property for the legend object to 'none'
. There are two ways to do this:
legend({'foo_bar'},'Interpreter','none'); %# One line, labels in a cell array
%# OR...
hLegend = legend('foo_bar'); %# Create the legend, returning a handle
set(hLegend,'Interpreter','none'); %# Set the property
You'll have to escape the underscore with a backslash \
as legend('foo\_bar')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With