plotannotationtopleft

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - User interface
Introduced first in SolidGeometry 5.0, Creation date: 2020-10-05, Last change: 2025-09-14

shows an annotation in the left side of the axis



See Also: SGfigureannotation , SGhelptext , plotannotation , plotannotationdelete , titleofcaller

Example Illustration

 missing image of plotannotationtopleft(str,vargs)

Syntax

t=plotannotationtopleft([str,vargs])

Input Parameter

str: string
vargs: list of optional parameters for annotation

Output Parameter

t: handle to textbox

Examples


plotannotationdelete; plotannotationtopleft ('Hello world\nthe quick brows'); shg




Copyright 2020-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, plotannotationtopleft, is designed to create a text annotation in the top-left corner of the current axis in a MATLAB figure. It is part of the SolidGeometry library and was introduced in version 5.0.

Input Parameters

Output

Algorithm Steps

  1. The function begins by extracting the str parameter from the input arguments using the getfuncparams function. If no string is provided, a default string is used.
  2. The remaining input arguments are stored in vargs for further use.
  3. If str is not already a cell array, it is converted into one. Special characters in the string are replaced with their corresponding ASCII characters.
  4. The position of the current axis is obtained using get(gca, 'Position').
  5. An annotation is created using the annotation function with the specified string and optional parameters. The annotation is aligned to the left.
  6. The position of the annotation is adjusted to ensure it appears in the top-left corner of the axis. This is done by calculating the new position based on the axis and annotation sizes.
  7. The position of the annotation is set using set(t, 'Position', np), and the figure is updated with drawnow.

Example Usage

An example of how to use this function is provided:

plotannotationdelete; 
plotannotationtopleft('Hello world\nthe quick brows'); 
shg

This example deletes any existing annotations, creates a new annotation with the specified text, and then brings the figure window to the front.

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