How Can I Create More Than One Figure

287 views (last 30 days)
Nathan
Nathan on 1 Mar 2014
Edited: Image Analyst on 2 Mar 2014
I can tell Matlab to make a basic figure such as a plot of 'x' versus 'y', but when I tell Matlab to make more than one figure in the same script, it will delete my first figure when it makes the next one. Do I need to tell Matlab to save each figure after it creates it and before making the next one? or am I missing something very obvious?

Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 1 Mar 2014
Edited: Azzi Abdelmalek on 1 Mar 2014
Use
hold on % many plot in the same figure
Or plot in different figures
figure
plot(x1,y1)
figure
plot(x2,y2)
See also subplot

Image Analyst
Image Analyst on 2 Mar 2014
Edited: Image Analyst on 2 Mar 2014
Something like this:
% Make plots in a 2 by 2 arrangement.
subplot(2,2,1); % Upper left
plot(1:10);
subplot(2,2, 2); % Upper right
bar(1:20);
subplot(2,2,3); % Lower left
imshow('cameraman.tif');
subplot(2,2,4); % Lower right
scatter(rand(20,1), rand(20,1));

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!