Syntax
ptxt=plotannotatecolors([sgcolord,varnames])
Input Parameter
sgcolord : | | colors for colofn |
varnames : | | list of variables or strings to be used to create an annotation |
Output Parameter
Examples
C=1, B=C, A=B
plotannotatecolors('rgb',A,B,C,'TEST')
SGfigure; plotannotation(plotannotatecolors('rgb',A,B,C,12,'TEST'),'FW');
Copyright 2023-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, plotannotatecolors
, is designed to generate an annotation string based on a specified color order and a list of variable names or strings. It is part of the SolidGeometry library and is used for creating annotations in plots.
Input Parameters
- sgcolord: A string representing the color order. Default is 'rgymb'.
- varnames: A list of variables or strings used to create the annotation.
Output
- ptxt: The resulting annotation string.
Algorithm Steps
- The function begins by extracting the color order from the input parameters using
getfuncparams
. If not provided, it defaults to 'rgymb'.
- It initializes an empty string
ptxt
to store the annotation text.
- The function iterates over each input parameter starting from the second one (since the first is the color order).
- For each parameter, it determines the corresponding color name using
colorname
and colofn
.
- It checks if the parameter has a name using
inputname
. If not, it checks if the parameter is a string.
- If the parameter is a string, it formats the annotation as
'color = "string_value"'
.
- If the parameter is not a string and has no name, it uses
sprintftext
to convert it to a string and formats the annotation as 'color = unnamed_value'
.
- If the parameter has a name, it formats the annotation as
'color = "variable_name"'
.
- Each formatted annotation is appended to
ptxt
, with a newline character if it is not the last parameter.
The function returns the complete annotation string ptxt
.
Algorithm explaination created using ChatGPT on 2025-08-19 08:11. (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