Syntax
subfig([p])
Input Parameter
p : | | position similar to subplot |
Examples
for i=1:4; SGfigure(SGbox([30,20,10])); view(-30,30);end
for i=1:4; SGfigure(SGbox([30,20,10])); view(-30,30); copyfig; end
for i=1:4; SGfigure(SGbox([30,20,10])); view(-30,30); copyfig; subfig(i); end
Copyright 2018-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, subfig
, is designed to create subfigures on the screen similar to the subplot
function in MATLAB. It is part of the SolidGeometry library and was introduced in version 4.2.
Input Parameters
- p: This parameter determines the position of the subfigure, similar to how positions are specified in
subplot
. If not provided, it defaults to 1.
Algorithm Steps
- Initialize a variable
delta
with a value of 50. This is used to adjust the screen size and figure size.
- Check the number of input arguments. If one argument is provided, assign it to
p
. Otherwise, set p
to 1.
- Retrieve the screen size using
get(get(gcf,'Parent'),'ScreenSize')
and adjust the width by subtracting delta
.
- Get the current figure's position and outer position using
get(gcf,'Position')
and get(gcf,'OuterPosition')
, then adjust the height by subtracting delta
.
- Calculate the number of columns
c
and rows r
that can fit on the screen by dividing the screen width and height by the figure's width and height, respectively.
- Determine the maximum number of figures
nmax
that can fit on the screen as the product of r
and c
.
- Use the
mod1
function to adjust p
within the range of nmax
.
- Calculate the horizontal and vertical spacing
dx
and dy
between figures.
- Determine the column
x
and row y
for the figure based on p
.
- Calculate the new position
[sx, sy]
for the figure on the screen.
- Move the current figure to the calculated position using
movegui(gcf,[sx sy])
.
- Pause briefly and then call
show
to update the display.
Algorithm explaination created using ChatGPT on 2025-08-19 00:37. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21