如何从合并两个图形中删除第三个图例 [英] how to remove third legend from merging two figures

查看:121
本文介绍了如何从合并两个图形中删除第三个图例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是这个问题 此处.

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

My problem is that in the 3rd figure I create (which has the 2 figures) there are 3 legends.The 2 are ok but there is a 3rd legend (which is a legend from figure 1 or 2). How can I erase it programatically?

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');

谢谢!

推荐答案

您必须在上方使用hasbehavior(tri,'legend',false)

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

这篇关于如何从合并两个图形中删除第三个图例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆