Matlab标签、图形和图例

6

如何使我的图例条目名称中有下划线而不让MATLAB认为我想要下划线作为下标?

2个回答

4

如果您不打算对图例字符串使用任何TeX或LaTeX格式设置,则一种选择是将图例对象的'Interpreter'属性设置为'none'。有两种方法可以实现这一点:

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

如果您不知道字符串的内容(例如包含下划线的文件名参数),则将“'Interpreter'”设置为“'none'”是正确的方法。 - Patrick

3

您需要使用反斜杠\来转义下划线,如legend('foo\_bar')


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接