Skip to main content

TextBox

TextBox [/W=winName /A=anchorCode /B=(r,g,b[,a])/B=trans /C/D={thickMult [, shadowThick [, haloThick ]]}/E[=exterior ] /F=frame /G=(r,g,b) /H=legendSymbolWidth /K/LS= linespace /M[=saMeSize ] /N=name /O=rot /R=newName /S=style /T=tabSpec /V=vis /X=xOffset /Y=yOffset /Z=freeze [textStr ]

The TextBox operation puts a textbox on the target or named graph. A textbox is an annotation that is not associated with any particular trace.

Parameters

textStr is the text that is to appear in the textbox. It is optional.

Flags

/A=anchorCodeanchorCode = LT for left top, LC for left center, LB for left bottom, MT for mid top, MC for mid center, MB for mid bottom, RT for right top, RC for right center, RB for right bottom.
anchorCode is a literal, not a string.
For interior textboxes, the anchor point is on the rectangular edge of the plot area of the graph window (where the left, bottom, right, and top axes are drawn).
For exterior textboxes, the anchor point is on the rectangular edge of the entire graph window.
/B=(r,g,b[,a])Sets color of the textbox background. r, g, b, and a specify the the color and optional opacity as RGBA Values.
/B=b
b =0:Opaque background.
b =1:Transparent background.
b =2:Same background as the graph plot area background.
b =3:Same background as the window background.
/Cchanges existing textbox.
/D={thickMult [, shadowThick [, haloThick]]}
thickMult multiplies the normal frame thickness of a textbox. The thickness may be set using just /D=thickMult.
shadowThick, if present, overrides Igor's normal shadow thickness. It is in units of fractional points.
haloThick governs the annotation's halo thickness (a surrounding band of the annotation's background color), which can vary from -1 to 10 points.
The default haloThick value is -1, which preserves the behavior of previous versions of Igor where the halo of all annotations was set by the global variable root:V_TBBufZone. Any negative value of haloThick (-0.5, for example) will be overridden by V_TBBufZone if it exists, otherwise the absolute value of haloThick will be used. A zero or positive value overrides V_TBBufZone.
Any of the parameters may be missing. To set haloThick to 0 without changing other parameters, use /D={,,0}.
/E[=exterior]/E or /E=1 forces textbox (or legend) to be exterior to graph (provided anchorCode is not MC) and pushes the graph margins away from the anchor edge(s). /E=2 also forces exterior mode but does not push the margins.
/E=0 returns it to the default (an "interior textbox" which can be anywhere in the graph window).
/F=frame
frame =0:No frame.
frame =1:Underline frame.
frame =2:Box frame (default).
/G=(r,g,b[,a])Sets color of the text in the textbox. r, g, b, and a specify the the color and optional opacity as RGBA Values.
/H=legendSymbolWidth
Sets width of the legend symbol (the sample line or marker) in points. Use 0 for the default, automatic width.
/KKills existing textbox.
/LS= linespaceSpecifies a tweak to the normal line spacing where linespace is points of extra (plus or minus) line spacing. For negative values, a blank line may be necessary to avoid clipping the bottom of the last line.
/M[=saMeSize]/M or /M=1 specifies that legend markers should be the same size as the marker in the graph.
/M=0 turns same-size mode off so that the size of the marker in the legend is based on text size.
/N=nameSpecifies the name of the textbox to change or create.
/O=rotSets the text's rotation in degrees counterclockwise. rot is a value from -360 to 360.
0 is normal horizontal left-to-right text, 90 is vertical bottom-to-top text.
/R=newNameRenames the textbox.
/S=style
style = 0:Single frame.
style = 1:Double frame.
style = 2:Triple frame.
style = 3:Shadow frame.
/T=tabSpectabSpec is a single number in points, such as /T=72, for evenly spaced tabs or a list of tab stops in points such as /T={50, 150, 225}.
/V=vis
vis =0:Annotation is invisible, and cannot be selected. The annotation is still listed in AnnotationList.
vis =1:Annotation is visible (the default).
/W=winNameOperates in the named graph window or subwindow. When omitted, action will affect the active window or subwindow. This must be the first flag specified when used in a Proc or Macro or on the command line.
When identifying a subwindow with winName, see Subwindow Syntax for details on forming the window hierarchy.
/X=xOffsetFor interior textboxes xOffset is the distance from anchor to textbox as a percentage of the plot area width.
For exterior textboxes xOffset is the distance from anchor to textbox as a percentage of the graph window width. See /E and /A.
/Y=yOffsetyOffset is the distance from anchor to textbox as a percentage of the plot area height (interior textboxes) or graph window height (exterior textboxes). See /E and /A.
/Z=freeze
freeze =0:Unfreezes it. Annotations are always unfrozen in page layouts.
freeze =1:Freezes annotation position (you can't move it with the mouse). This works in graphs but is not implemented for page layouts.

Details

Use the optional /W=winName flag to specify a specific graph or layout window. When used on the command line or in a Macro, Proc, or Window procedure, /W must precede all other flags.

If the /C flag is used, it must be the first flag in the command (except that it may follow an initial /W) and must be followed immediately by the /N=name flag.

If the /K flag is used, it must be the first flag in the command (or follow an initial /W) and must be followed immediately by the /N=name flag with no further flags or parameters.

textStr is optional. If missing, the textbox text is unchanged. This allows changes to the textbox to be made through the flags without changing the text.

A textbox can have at most 100 lines.

textStr can contain escape codes which affect subsequent characters in the text. An escape code is introduced by a backslash character. In a literal string, you must enter two backslashes to produce one. See Backslashes in Annotation Escape Sequences for details.

Using escape codes you can change the font, size, style and color of text, create superscripts and subscripts, create dynamically-updated text, insert legend symbols, and apply other effects. See Annotation Escape Codes for details.

The characters "" in a textbox indicate that you specified an invalid escape code or used a font that is not available.

Examples

TextBox/C/N=t1/X=25/Y=50

moves the textbox named t1 to the location defined by X=25 and Y=50.

TextBox/C/N=t1 "New Text"

changes the text for t1.

See Also

Tag, Legend, AppendText, AnnotationInfo, AnnotationList

Annotation Escape Codes

See printf for formatting codes used in formatStr.

Programming with Annotations

Trace Names, Programming With Trace Names