9 AUTOGRAPH and SGS Coordinate Systems

 9.1 Making AUTOGRAPH use the current SGS zone
 9.2 Setting the SGS coordinates to match an AUTOGRAPH plot
 9.3 SGS/AUTOGRAPH coordinate conversions

9.1 Making AUTOGRAPH use the current SGS zone

AUTOGRAPH can be made to plot within the current GKS viewport as follows:

        CALL SNX_AGWV

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.

9.2 Setting the SGS coordinates to match an AUTOGRAPH plot

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:

        Plot the graph with AUTOGRAPH
        CALL SNX_AGCS

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:

        CALL SGS_ZONE( 0.0, 1.0, 0.0, 1.0, IZGW, J )
        CALL SGS_SW( 0.0, 1.0, 0.0, 1.0, J )

9.3 SGS/AUTOGRAPH coordinate conversions

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:

        UX = SNX_AGGUX( GX )

To convert a grid y coordinate to a user y coordinate:

        UY = SNX_AGGUY( GY )

To convert a user x coordinate to a grid x coordinate:

        GX = SNX_AGUGX( UX )

To convert a user y coordinate to a grid y coordinate:

        GY = SNX_AGUGY( UY )

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.