Contents Previous Next Subchapters

Converting Plotting Coordinates To A Graphic Window Location
Syntax gcoord(xy)
See Also gcoord , gaddwin

Description
Returns the relative coordinates within the current graphic window that corresponds to the (x,y) plotting locations in the current viewport , where x and y are integer, real, or double-precision column vectors of equal length. The return value is a two column real matrix with the same number of rows as x and y. The i-th row of the return value corresponds to the plotting location (x(i), y(i)).

Example
You can use this function to place text at a certain location within a graphic plot. If you enter
     clear
     gplot(seq(3), seq(3))
     x = 2
     y = 2
     p = gcoord(x, y)
     gaddtext("(2,2)", p)
O-Matrix will label the point (2,2) with its Cartesian coordinates.