How to combined saved figure files in a subplot
4 views (last 30 days)
Show older comments
I have two matlab .figure file
Now want to plot these two figures into a single subplot
i have use this code
%First Figure
h1 = openfig('ba-da CS Cz.fig','reuse'); % open figure
ax1 = gca; % get handle to axes of figure
%Second Figure
h2 = openfig('ba-da CS Fz.fig','reuse');
ax2 = gca;
%third new figure
h3 = figure; %create new figure
s1 = subplot(1,2,1); %create and get handle to the subplot axes
ylim([0 50]);
s2 = subplot(1,2,2);
ylim([0 50]);
fig1 = get(ax1,'children'); %get handle to all the children in the figure
fig2 = get(ax2,'children');
copyobj(fig1,s1); %copy children to new parent axes i.e. the subplot axes
copyobj(fig2,s2);
but the x-axis for both subplot seems shifted from the original individual figure.
anybody can advice on the idea to resolve this.? Many thanks
2 Comments
Sudheer Bhimireddy
on 4 Aug 2020
From the figures shown, it doesn't look like the x-axis for Fig 1,2 starts at 0. To verify, check the axis limits from the figure XData.
Answers (0)
See Also
Categories
Find more on Subplots 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!