Merging 2 plots that are already saved as .fig files
I have a script that reads data from an s2p file with data = read(rddata.data,name) where ‘name is the name of the s2p file. I am then setting certain parameters for the plot like axis, legend, titles, and save the file as .fig file which i can open on its own. Is there a way to take 2 such files and put them on the same graph easily with just the info from the .fig file directly? I tried doing the following:
% Load saved .fig files
fig1 = openfig(‘File1.fig’);
fig2 = openfig(‘File2.fig’);
% Create new figure with tiled layout
figure(100);
tiledlayout(1,2);
%title(‘Figure 1’);
% Plot axes contents from figure 1
nexttile;
ax1 = copyobj(fig1.Children, gcf);
%copyobj(axes1, gca);
% Plot axes contents from figure 2
nexttile;
ax2 = copyobj(fig2.Children, gcf);
saveas(gcf, ‘combined_plot.png’);
when I run this I get a weird overlay of just one of the plots and behind the one plot there seems to be 2 blank graph windows that are being blocked by the one graph showing.I have a script that reads data from an s2p file with data = read(rddata.data,name) where ‘name is the name of the s2p file. I am then setting certain parameters for the plot like axis, legend, titles, and save the file as .fig file which i can open on its own. Is there a way to take 2 such files and put them on the same graph easily with just the info from the .fig file directly? I tried doing the following:
% Load saved .fig files
fig1 = openfig(‘File1.fig’);
fig2 = openfig(‘File2.fig’);
% Create new figure with tiled layout
figure(100);
tiledlayout(1,2);
%title(‘Figure 1’);
% Plot axes contents from figure 1
nexttile;
ax1 = copyobj(fig1.Children, gcf);
%copyobj(axes1, gca);
% Plot axes contents from figure 2
nexttile;
ax2 = copyobj(fig2.Children, gcf);
saveas(gcf, ‘combined_plot.png’);
when I run this I get a weird overlay of just one of the plots and behind the one plot there seems to be 2 blank graph windows that are being blocked by the one graph showing. I have a script that reads data from an s2p file with data = read(rddata.data,name) where ‘name is the name of the s2p file. I am then setting certain parameters for the plot like axis, legend, titles, and save the file as .fig file which i can open on its own. Is there a way to take 2 such files and put them on the same graph easily with just the info from the .fig file directly? I tried doing the following:
% Load saved .fig files
fig1 = openfig(‘File1.fig’);
fig2 = openfig(‘File2.fig’);
% Create new figure with tiled layout
figure(100);
tiledlayout(1,2);
%title(‘Figure 1’);
% Plot axes contents from figure 1
nexttile;
ax1 = copyobj(fig1.Children, gcf);
%copyobj(axes1, gca);
% Plot axes contents from figure 2
nexttile;
ax2 = copyobj(fig2.Children, gcf);
saveas(gcf, ‘combined_plot.png’);
when I run this I get a weird overlay of just one of the plots and behind the one plot there seems to be 2 blank graph windows that are being blocked by the one graph showing. ploting, .fig files MATLAB Answers — New Questions