tiling pre-existing plots into a figure
10 views (last 30 days)
Show older comments
I am a matlab beginner. I have some code that creates various plots using functions such as plot, semilogx, etc. Later on in the code, I want to create a figure and then tile the previously-created plots into it using the subplot command. How do I reference the previously-made plots and get them into the figure.
0 Comments
Answers (1)
Grzegorz Knor
on 11 Sep 2011
figure
plot(1:10)
figure
semilogx(1:10)
figure
semilogy(1:10)
figure
bar(1:10,rand(1,10))
a = findobj('Type','axes');
figure
m = floor(sqrt(length(a)));
n = ceil(length(a)/m);
for k=1:length(a)
tmp1 = subplot(m,n,k);
tmp2 = copyobj(a(k),gcf);
set(tmp2,'Position',get(tmp1,'Position'))
delete(tmp1)
end
0 Comments
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!