Put figures (.fig) in one page

12 vues (au cours des 30 derniers jours)
Mohamed Yassine
Mohamed Yassine le 22 Mai 2011
Hi, I've 4 figures (1.fig, ..., 4.fig) and I want to put them in one page without running another time my program (it take 1 week) in order to have a page with the 4 figures (2 by 2) and export it in eps. Pleas give me a solution (matlab code)
thank you

Réponse acceptée

Matt Fig
Matt Fig le 22 Mai 2011
Before you do anything, save each of your four figures as a MATLAB figure so your figures aren't lost!
Once you do that, close them all and run this example. The example makes four figures then pauses for you to look at them. When you are ready, press return at the command line to copy them all to a single figure. Once you understand the example, build your own to work with your figures. You will have to open your figures again, then run the relevant part of the code.
% Make some figures...
figure
plot(1:10)
figure
plot((1:10).^2)
figure
plot((1:10).^3)
figure
plot((1:10).^4)
pause % Wait for user to hit return...
fh = figure;
for ii = 1:4
subplot(2,2,ii)
P{ii} = get(gca,'pos');
end
clf
F = findobj('type','figure');
for ii = 2:5
ax = findobj(F(ii),'type','axes');
set(ax,'parent',fh,'pos',P{6-ii})
close(F(ii))
end

Plus de réponses (2)

Ben Mitch
Ben Mitch le 22 Mai 2011
There is an easy way, which depends a bit on what you've got in your figures. Assuming you've only got 1 axis per figure, this would work.
open 1.fig
a1 = gca;
open 2.fig
a2 = gca;
figure(3)
set(a1, 'parent', 3, 'position', p1);
set(a2, 'parent', 3, 'position', p2);
You'll have to figure out p1 and p2 for yourself. If you do have more axes than one per figure, try the following to get a list of them.
open 1.fig
a1 = get(gcf, 'children');
...

Mohamed Yassine
Mohamed Yassine le 22 Mai 2011
thank you every body

Catégories

En savoir plus sur Graphics Performance 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!

Translated by