SUBFIGURE

Version 1.0.0.0 (12.4 KB) by Matt Fig
SUBFIGURE creates figures in tiled positions.
2.6K Downloads
Updated 26 Feb 2009

View License

SUBFIGURE creates figures in tiled positions.
H = SUBFIGURE(a,b,c) breaks the computer screen into an a-by-b matrix of
small figures, selects the c-th figure for the current figure, and
returns its handle. The figures are counted along the top row of the
computer screen, then the second row, etc. This is the same way that
SUBPLOT tiles axes in a figure. H is not returned if not requested.
More than one figure can be created by calling SUBFIGURE with a cell of
positions, or by specifying 'all' in the position argument. If 'all' is
called, this will be treated as if a cell {1:a*b} had been passed. If
more than one figure is created at a time, SUBFIGURE will create an axes
object in each figure and H will have two columns. Each row of H will
contain the figure handle and corresponding axes handle.
SUBFIGURE has a 37 pixel offset from the bottom of the screen built-in.
Since this is the first line of code, it is easily changed by the user
for their particular system if needed or desired.

SUBFIGURE(a,b,'all') or SUBFIGURE(a,b,{1:a*b}) plots a*b figures
on screen in a a-by-b pattern.
SUBFIGURE(a,b,C), where C is a vector, specifies a single figure position
that covers all the subfigure positions in C.
SUBFIGURE(N,N,{1:N:N^2}) plots N figures on the left side of the screen.
SUBFIGURE(N,N,1:N:N^2) plots one figure that covers the figures from the
previous example, in the left Nth of the screen.
SUBFIGURE(N,N,{1:N}) plots N figures on the top of the screen.
SUBFIGURE(N,N,1:N) plots one figure on the top Nth of the screen.
SUBFIGURE(a,b,c,'replace') if a figure exists at position c, replaces it.
SUBFIGURE(...,PROP1, VALUE1, PROP2, VALUE2, ...) sets the specified
property-value pairs for the figure(s).
SUBFIGURE(5,5,{1:5:25},'menubar','none') plots 5 figures with no menubars
on the left hand side of the screen, this can be useful when plotting
subfigures because the menubars can take up a lot of space (relatively).

The screenshot was made with the following:
x = -9*pi:.001:9*pi;
y = sin(x)./x;
subfigure(3,2,[1 2],'menubar','none')
plot(x,y)
y2 = cos(x)./x;
subfigure(3,2,[5 6],'menubar','none')
plot(x,y2),ylim([-1 1])
subfigure(3,4,[6 7],'menubar','none')
plot(x,1./y),ylim([-200 200])
[x,y,z] = peaks(40);
H = subfigure(3,4,{5 8},'menubar','none');
mesh(H(3),x,y,z)
surf(H(4),x,y,z)
Also included is the test harness written to test SUBFIGURE for errors. It is included mainly because it can serve as a demo.
Additionally, there is a version of SUBFIGURE which will run on Matlab 6.5 This is included as a convenience.

Tested on 2006a, 2007a,b Ver 6.5
Please email me about any bugs found.

Cite As

Matt Fig (2024). SUBFIGURE (https://www.mathworks.com/matlabcentral/fileexchange/23135-subfigure), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Interactive Control and Callbacks in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0