开发者

Matlab labeling, plots, legends

开发者 https://www.devze.com 2023-02-23 00:47 出处:网络
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 f

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

0

精彩评论

暂无评论...
验证码 换一张
取 消