如何删除合并两个数字的第三个图例

时间:2013-03-21 08:42:35

标签: matlab plot

我在提到这个问题 here

我的问题是,在我创建的第3个图中(有2个数字)有3个图例.2个没问题但是有第3个图例(这是图1或图2中的图例)。 如何以编程方式擦除它?

fig1=open('fig1.fig');
fig2=open('fig2.fig');

ax1=get(fig1,'Children');
ax2=get(fig2,'Children');


for i = 1 : numel(ax2) 

   ax2Children = get(ax2(i),'Children');
   tri=get(ax1(i),'Children');
   hold on;
   first=copyobj(tri, ax1(i));
   second=copyobj(ax2Children, ax1(i));

end


set(first,'color','g','marker','o');
set(second,'color','b','marker','x');
legend(first, {'first'}, 'Location','NorthWest', 'Color','g');
legend(second, {'second'}, 'Location','NorthWest', 'Color','b');

谢谢!

1 个答案:

答案 0 :(得分:2)

您必须使用上面的hasbehavior(tri,'legend',false)

set(hasbehavior(temp,'legend',false)