plotannotatecolors

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - User interface
Introduced first in SolidGeometry 5.3, Creation date: 2023-03-29, Last change: 2025-09-15

returns an annotation string from plotannotation



See Also: plotannotation , colofn , nofcolmap , plotannotationtext , plotannotationdelete , plotannotationtopleft

Example Illustration

 missing image of plotannotatecolors(sgcolord,varnames)

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

ptxt: annotation string

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

Output

Algorithm Steps

  1. The function begins by extracting the color order from the input parameters using getfuncparams. If not provided, it defaults to 'rgymb'.
  2. It initializes an empty string ptxt to store the annotation text.
  3. The function iterates over each input parameter starting from the second one (since the first is the color order).
  4. For each parameter, it determines the corresponding color name using colorname and colofn.
  5. It checks if the parameter has a name using inputname. If not, it checks if the parameter is a string.
  6. If the parameter is a string, it formats the annotation as 'color = "string_value"'.
  7. 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'.
  8. If the parameter has a name, it formats the annotation as 'color = "variable_name"'.
  9. 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