subplotnumber

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 5.1, Creation date: 2021-11-18, Last change: 2025-09-15

simply returns the number of subplots



See Also: plotannotation , selectsubplot

Example Illustration

 missing image of subplotnumber(fig)

Syntax

[n,subs]=subplotnumber([fig])

Input Parameter

fig: default is gcf

Output Parameter

n: number of subplots
subs: list of handles

Examples


PLsample; subplotnumber




Copyright 2021-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, subplotnumber, is designed to determine the number of subplot axes present in a given figure. It is part of the SolidGeometry library and was introduced in version 5.1. The function can be used to retrieve both the count of subplots and their respective handles.

Input Parameters

Output Results

Algorithm Steps

  1. The function begins by determining the figure to be analyzed. It uses the helper function getfuncparams to retrieve the first argument from varargin, defaulting to gcf if no argument is provided.
  2. It then identifies all child objects of the specified figure that are of type 'Axes' using the findobj function. This effectively filters out all subplot axes within the figure.
  3. The number of subplot axes is calculated using numel, which counts the elements in the subs array.
  4. The function returns the count of subplots (n) and the list of subplot handles (subs).

Example Usage

To use this function, you can call it after creating a figure with subplots. For instance:

PLsample; subplotnumber

This will return the number of subplots and their handles for the current figure.

Algorithm explaination created using ChatGPT on 2025-08-18 22:21. (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