Contents Previous Next Subchapters

Placing Text In The Current Graphic Window
Syntax gaddtext(textwindow coordinates)
gaddtext(
textwindow coordinatestext coordinates)
gaddtext(
textwindow coordinatestext coordinatesdirection)
See Also gfont , gdeltext , gcoord

Description
Places the specified text at the specified location within the current graphic window, where text is a character matrix and the integer, real, or double-precision two element row vector window coordinates specifies a point using relative coordinates within the window.

If present, text coordinates specifies the point in the text that corresponds to the specified location in the window. It is an integer, real, or double-precision two element row vector specifying the relative coordinates within the text. If text coordinates is not present, the center of the text is used.

If direction is not present, the text is placed on a horizontal baseline. If direction is present, it specifies the direction of the baseline for the text. It is a two element integer, real, or double-precision row vector with each of its elements between -1 and +1. The first element is a change in horizontal location and the second element is a change in vertical location that corresponds to the direction. The direction [1,1] corresponds to a line from the lower left corner of the window to the upper right, [1,0] corresponds to a line from the left side of the window to the right (horizontal), [0,1] corresponds to a line from the bottom of the window to the top (vertical), [-1,0] corresponds to a line from the right side of the window to the left (upside-down).

The return value of gaddtext is an integer scalar which can be used in conjunction with the gdeltext function to delete a specific piece of text.

Examples

Two Arguments
To place the center of the phrase  
     Center Of Window
in the center of the current graphic window, you would enter
     clear
     text         = "Center Of Window"
     window_coord = [.5, .5]
     id           = gaddtext(text, window_coord)
O-Matrix would then respond with the following graph:

Three Arguments
To place the upper right corner of the phrase  
     Upper-right
     corner
at the upper right corner of the current graphic window, you would enter
     clear
     text               = {"Upper-right", "corner"}
     window_coord = [1., 1.]
     text_coord   = [1., 1.]
     id           = gaddtext(text, window_coord, text_coord)

Four Arguments
To place the center of the phrase  
     Diagonal text
in the center of the current graphic window and along a baseline from the lower left to upper right of the current graphic window, you would enter
     clear
     text         = "Diagonal text"
     window_coord = [.5, .5]
     text_coord   = [.5, .5]
     direction    = [1., 1.]
     id           = gaddtext(text, window_coord, text_coord, direction)