plotannotationtext

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 5.4, Creation date: 2024-05-08, Last change: 2025-09-15

create quick an efficient text to be used in combination with plotannotation

Description

annotating figures should be used more efficiently

See Also: plotannotation , plotannotatecolors , plotannotationdelete , plotannotationtopleft

Example Illustration

 missing image of plotannotationtext(NAME,VALU)

Syntax

txt=plotannotationtext([NAME,VALU])

Input Parameter

NAME: 1st and each second are the names of variables
VALU: 2nd and each second are values of variables

Output Parameter

txt: char array

Examples


plotannotationtext('CYAN','Spring','YELLOW','Cage','GREEN','Lid (optional)','RED',0.03,'BLUE',1.23e9)
txt=ans;
figure; plotannotation(txt);




Copyright 2024-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, plotannotationtext, is designed to create a formatted text string for annotating plots efficiently. It is part of the SolidGeometry library and is used to generate annotations for figures.

Input Parameters

Output

Algorithm Steps

  1. Initialize variables k and ll to zero.
  2. Determine the maximum length of the variable names by iterating through every odd argument.
  3. Set the format string forms to align the variable names and values.
  4. Check if the number of arguments is even; if not, throw an error.
  5. Iterate through the arguments in pairs (name and value):
  6. Remove the trailing newline character from txt.
  7. If no output is requested, delete existing annotations and create a new annotation with the formatted text.

Example Usage

To use this function, you can call it with pairs of names and values:

plotannotationtext('CYAN','Spring','YELLOW','Cage','GREEN','Lid (optional)','RED',0.03,'BLUE',1.23e9)

This will generate a formatted text string that can be used with the plotannotation function to annotate a figure.

Algorithm explaination created using ChatGPT on 2025-08-19 08:23. (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