Transferring 4 already plotted figures into one with subplots
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello community, I have currently from my code 4 printed figures: figure(101); figure(102), figure(103) & figure(104) (these also have subplots (2x2) of their own).
I would like to like to transfer them to be in one figure all together (a figure with 2x2 subplots), subplot(2,2,1) being figure(101), subplot(2,2,2) being figure(102), etc...
Any idea how I can do this in the best way possible?
%Example for the 4 figures:
colors = ['b','r','g','k'];
for j=1:4
figure(100+j);
for i = 1:4
subplot(2,2,i); hold on;
title(strcat('Figure: ',num2str(j),'-',num2str(i)))
plot((1:10).^i,'Color',colors(j));
end
end
0 commentaires
Réponse acceptée
per isakson
le 20 Mai 2018
Modifié(e) : per isakson
le 20 Mai 2018
AFAIK: Matlab doesn't provide a specific tool to copy the content of separate figures to subplots of one figure. However, there might be something useful in The File Exchange (FEX).
Search the FEX: tag:subplot figure copy. The second hit is MontageFigures by Nick Sinclair, which I downloaded and tested:
Create four separate figures
colors = ['b','r','g','k'];
for jj=1:4
figure(100+jj);
for ii = 1:4
plot((1:10).^ii,'Color',colors(jj));
title( sprintf( 'Figure: %d - %d', jj, ii ) )
end
end
Copy the content of the four figures to one new figure
montagefigures( [101,102,103,104],2,2)
Worked without any problems.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Subplots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!