How to set the parent of the subplot in a neat way?
34 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!