How to set the parent of the subplot in a neat way?
34 次查看(过去 30 天)
显示 更早的评论
I know my question could sound strange at the first glance. Here I would like explain my question in more details. My MATLAB code goes as follows.
x = linspace(0, 2*pi, 11);
fig1 = figure('Name', 'A');
fig2 = figure('Name', 'B');
ax = subplot(1,2,1);
plot(x, sin(x.^2));
I have two figures, named A and B. The parent of ax will be fig2 by default. The question is that how to set the parent of ax to be fig1 rather than fig2 explicitly when I create ax? I know I could change the parent of ax after I create using ax.Parent = fig1, i.e.,
x = linspace(0, 2*pi, 11);
fig1 = figure('Name', 'A');
fig2 = figure('Name', 'B');
ax = subplot(1,2,1);
plot(x, sin(x.^2));
ax.Parent = fig1;
Thank you!
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!