请教高手一个关于Legend的问题
我画的图里面有一部分点或线不用给出图例,求教高手这个怎么处理;另外,我上了“Mathworks”的网站,这是网站在处理这个问题的时候i给出的例子:
This example creates a graph of random data values and draws a line at the mean y value. The blue data line does not appear in the legend because that line object has its IconDisplayStyle property of the associated LegendEntry object set to off. See Properties for Controlling Legend Content for more information.
To execute the following code, copy it into a separate function file, save it as annotation_property_line.m, and run it from the Command Window.
function annotation_property_line
dat = rand(50,1);
hLine = plot(dat);
plotMean % Nested function draws a line at mean value
set(get(get(hLine,'Annotation'),'LegendInformation'),...
'IconDisplayStyle','off'); % Exclude line from legendlegend('mean')
function plotMean
xlimits = get(gca,'XLim');
meanValue = mean(dat);
meanLine = line(,...
,'Color','k','LineStyle','-.');
end
end
我按照网站上面的步骤运行这个函数,结果图能画出来,但Legend处仍无法处理;
即出现:
“??? There is no 'Annotation' property in the 'lineseries' class”的错误提示;
请高手不吝赐教,这个问题该怎么解决,非常感谢!
http://www.google.cn/search?hl=zh-CN&;newwindow=1&ei=i_XWSvavJJyDkAW6h7HQCA&sa=X&oi=spell&resnum=0&ct=result&cd=1&ved=0CAYQBSgA&q=controlling+legend&spell=1]http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/creating_plots/braliom.html&http://www.google.cn/search?hl=zh-CN&;newwindow=1&ei=i_XWSvavJJyDkAW6h7HQCA&sa=X&oi=spell&resnum=0&ct=result&cd=1&ved=0CAYQBSgA&q=controlling+legend&spell=1
,这是那个算例网址的连接,如果我没写清楚地画请参照这个网页上的东西
[ 本帖最后由 zxerdo 于 2009-10-15 21:45 编辑 ] 参考:
http://forum.vibunion.com/forum/viewthread.php?tid=73381&highlight=legend
页:
[1]