Syntax
h=textP(p,str,[delx,dely,Fnts])
Input Parameter
p : | | point |
str : | | texlabel |
delx : | | displacement x; default is 0.02 (2%) |
dely : | | displacement y; default is 0.02 (2%) |
Fnts : | | Fontsize; default is 16 |
Output Parameter
Copyright 2017-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, textP
, is designed to place a text label at a specified point in a plot, with optional displacement and font size adjustments. It is part of the SolidGeometry library.
Input Parameters
- p: A point in the plot where the text will be placed. It can be a 2D or 3D point.
- str: The text label to be displayed, formatted as a TeX label.
- delx (optional): The horizontal displacement of the text from the point
p
. Default is 0.02 (2% of the axis range).
- dely (optional): The vertical displacement of the text from the point
p
. Default is 0.02 (2% of the axis range).
- Fnts (optional): The font size of the text. Default is 16.
Output
- h: A handle to the text object created in the plot.
Algorithm Steps
- Retrieve the current axis limits using the
axis
function.
- Set default values for
delx
, dely
, and Fnts
if they are not provided in varargin
.
- Calculate the displacement in the x and y directions based on the axis limits and the specified or default displacements.
- Check if the point
p
is empty. If it is, return an empty handle.
- If
p
is a 2D point, append a zero to make it a 3D point.
- Create a text object at the displaced position using the
text
function, with the specified font size and color.
Algorithm explaination created using ChatGPT on 2025-08-19 00:28. (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