guohf 发表于 2010-9-14 14:00:22

请问怎样将一幅图的图例legend复制到另一幅图中?

如题,谢谢

qibbxxt 发表于 2010-9-14 15:07:26

1# guohf

代码如下:
clear;clc;close all
h1 = figure(1);
fplot(@sin,[-1,1]);
legend('y=sin(x)');
h1_o = findobj(h1,'Tag','legend');
h2=figure(2);
fplot(@cos,[-1,1]);
h2_n=copyobj(h1_o,h2);
cc=get(h2_n,'String');
set(h2,'Tag',cc{:});
页: [1]
查看完整版本: 请问怎样将一幅图的图例legend复制到另一幅图中?