2011-04-07 70 views

回答

3

你必须用反斜杠\逃脱下划线作为legend('foo\_bar')

4

一个选项,如果你不打算使用任何的TeX或LaTeX格式为你的传奇字符串,是设置'Interpreter' property图例对象为'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 
+0

设置'“Interpreter''到'” none''是正确的做法,如果你不知道该字符串的内容(如参数,如该名包含下划线)。 – Patrick 2016-01-13 22:13:38