Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: 20 images in 3x3 plot
Replies: 2   Last Post: Jan 10, 2013 3:00 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
ImageAnalyst

Posts: 12,930
Registered: 12/26/06
Re: 20 images in 3x3 plot
Posted: Jan 3, 2013 8:24 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Lim " <limhueynee@gmail.com> wrote in message <kc3eq7$80b$1@newscl01ah.mathworks.com>...
> I have 20 images and I want to put them in a 3x3 subplot in each figure, how to call up the new figure when the first figure is 'full'?
>
> nCol = 20;
> for k = 1:nCol
> C1 = original;
> C1(rgb_label ~= k) = 0;
> blah{k} = C1;
> end
>
> I am now using the painstaking subplot code:
> figure(1),subplot(3,3,1),imshow(blah{1});
> subplot(3,3,2),imshow(blah{2});
> ...
>
> Please help.

==================================================
Try this:

format longg;
format compact;
clc; % Clear command window.
workspace; % Make sure the workspace panel is showing.
fontSize = 25;

currentFigureNumber = 0; % Just for plot titles
for k = 1 : 12
% Determine the plot number.
plotNumber = mod(k+2, 3)+1;

% Open a brand new figure if necessary.
if plotNumber == 1
figure;
% Increment counter. Optional - Just for plot titles.
currentFigureNumber = currentFigureNumber + 1;
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
end

% Make the subplot in the right place.
subplot(1, 3, plotNumber);

% Plot your data.
plot(rand(1,5), 'LineWidth', 2);
grid on;
caption = sprintf('Plot #%d on figure %d',...
plotNumber, currentFigureNumber);
title(caption, 'FontSize', 24);
end



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.