马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
我画的图里面有一部分点或线不用给出图例,求教高手这个怎么处理;
另外,我上了“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([xlimits(1) xlimits(2)],...
[meanValue meanValue],'Color','k','LineStyle','-.');
end
end
我按照网站上面的步骤运行这个函数,结果图能画出来,但Legend处仍无法处理;
即出现:
“??? There is no 'Annotation' property in the 'lineseries' class”的错误提示;
请高手不吝赐教,这个问题该怎么解决,非常感谢!
[url=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]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[/url]
,这是那个算例网址的连接,如果我没写清楚地画请参照这个网页上的东西
[ 本帖最后由 zxerdo 于 2009-10-15 21:45 编辑 ] |