Matlab labeling, plots, legends
How do I get my legend entry to have an underscore in the name without MATLAB thinking I want the underscore to me开发者_如何学Goan 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')
精彩评论