5

如何让我的图例条目在名称中包含下划线,而 MATLAB 不认为我希望下划线表示下标?

4

2 回答 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
于 2011-04-07T19:03:01.740 回答
3

您必须使用反斜杠来转义\下划线legend('foo\_bar')

于 2011-04-07T17:07:09.103 回答