Matlab:情节到子情节
Matlab: plots to subplot
我想将图形中的情节重现为新图形的子图。考虑以下
f1 = figure;
p1 = plot([1 2],[1 2], 'r');
legend(p1, 'Test')
f2 = figure;
p2 = plot([2 3], [2 3], 'g');
f3 = figure;
h1 = subplot(1,2,1);
h2 = subplot(1,2,2);
现在,我的目的是重现 p1
和 p2
作为 f3
的子图。我已经尝试了很多组合,包括以下但没有奏效
ax1 = copyobj(f1.Children, h1);
ax2 = copyobj(f2.Children, h2);
this link 对类似问题的回答没有帮助。我正在使用 R2016b。
这对我有用:
f1 = figure;
p1 = plot([1 2],[1 2], 'r');
legend(p1, 'Test')
f2 = figure;
p2 = plot([2 3], [2 3], 'g');
f3 = figure;
h1 = subplot(1,2,1);
h2 = subplot(1,2,2);
ax1 = copyobj(p1, h1);
ax2 = copyobj(p2, h2);
图三显示了两个子图,其中包含 p1 和 p2 中的数据(根据需要):
我想将图形中的情节重现为新图形的子图。考虑以下
f1 = figure;
p1 = plot([1 2],[1 2], 'r');
legend(p1, 'Test')
f2 = figure;
p2 = plot([2 3], [2 3], 'g');
f3 = figure;
h1 = subplot(1,2,1);
h2 = subplot(1,2,2);
现在,我的目的是重现 p1
和 p2
作为 f3
的子图。我已经尝试了很多组合,包括以下但没有奏效
ax1 = copyobj(f1.Children, h1);
ax2 = copyobj(f2.Children, h2);
this link 对类似问题的回答没有帮助。我正在使用 R2016b。
这对我有用:
f1 = figure;
p1 = plot([1 2],[1 2], 'r');
legend(p1, 'Test')
f2 = figure;
p2 = plot([2 3], [2 3], 'g');
f3 = figure;
h1 = subplot(1,2,1);
h2 = subplot(1,2,2);
ax1 = copyobj(p1, h1);
ax2 = copyobj(p2, h2);
图三显示了两个子图,其中包含 p1 和 p2 中的数据(根据需要):