AUTOGRAPH can be made to plot within the current GKS viewport as follows:
This will cause the AUTOGRAPH graph window (the rectangle which contains the labels, axes, grid, etc.) to be coincident with the GKS viewport. A specially convenient way to set up a GKS viewport is by means of SGS; a call to SNX_AGWV following any zone creation or selection call will cause AUTOGRAPH to arrange its plot within that zone. The zone may be of any aspect ratio, with the proviso that labels may overflow very narrow ones.
Once AUTOGRAPH has established its plotting strategy (usually after drawing the graph, or either the background or curve) it may be necessary to make additions to the plot or to perform input. This can be done conveniently as follows:
The call to SNX_AGCS sets the extent (in world coordinates) of the current SGS zone, presumed to cover the AUTOGRAPH graph window (the rectangular area within which the whole AUTOGRAPH plot, including labels etc., is drawn), so that the AUTOGRAPH grid window (the rectangular area within which the curve itself is plotted) has bounds (0.0,1.0,0.0,1.0). Thus the world coordinates of the SGS zone are now AUTOGRAPH grid coordinates. Clipping requirements may then make it necessary to create another zone covering just the grid window, but still with grid coordinates. This is easily accomplished by:
For data-related plotting and input, four functions are provided to perform the necessary coordinate conversions. The two sets of coordinates are respectively the grid coordinates (GX,GY) and the user (i.e. data) coordinates (UX,UY).
To convert a grid x coordinate to a user x coordinate:
To convert a grid y coordinate to a user y coordinate:
To convert a user x coordinate to a grid x coordinate:
To convert a user y coordinate to a grid y coordinate:
The grid coordinates are such that the grid window part of the AUTOGRAPH graph window has bounds (0.0,1.0,0.0,1.0); they match the world coordinates for a zone set up with SNX_AGCS (see the previous section).
The user coordinates relate to the actual data values supplied, even though the plotting may have been done with logarithmic scaling or reversed directions.