Previous Chapter LLUs Home Next Chapter IndexNCAR Graphics depends on three different coordinate systems and a transformation between them to plot your data to the screen. Before any plotting can be done, this transformation must be defined, so it is a critical part of your graphics program. Each of the coordinate systems and the transformation are defined below.

**GSVP**- Set viewport coordinates.
**GSWN**- Set window coordinates.
**GSELNT**- Select normalization transformation.

**SET**- Set viewport and user coordinates and logarithmic scaling.
**GETSET**- Retrieve viewport user coordinate and logarithmic scaling values.

The** World Coordinate System** (WCS) is the system in which you perform your calculations. It can have units of feet, meters, millibars, or whatever engineering units apply to the calculations. World coordinates are Cartesian coordinates expressed as real numbers. You can select a rectangular subspace of world coordinates for output; this space is called a "window." In world coordinates, both axes must monotonically increase starting with a data origin in the lower left coordinate of the frame.

**Normalized Device Coordinates** (NDCs) is a device-independent coordinate system used by GKS as an addressing system for a virtual (any) plotting device. In GKS, you must perform a transformation from WCs to NDCs. Whereas WCs have variable ranges, NDCs have a constrained range limited to (0.,0.) in the lower left corner and (1.,1.) in the upper right corner. A rectangular subspace of NDCs can be selected for output; this space is called a "viewport."

The **user coordinate system** in NCAR Graphics adds two important extensions to GKS world coordinates: "mirror-imaging" of an axis, and "nonlinear scaling" of an axis. Thus, in user coordinates, windows can be defined in which the horizontal coordinate of the window might be meters varying from 1000. at the left to 100. at the right (mirror-imaging), and the vertical coordinate might vary from 10*2* at the bottom to 10*3* at the top in logarithmic scaling.

If you are working in Cartesian space with linear scaling and standard minimum to maximum axis scaling, then world coordinates and user coordinates are equivalent.

The process of transforming data from WCs into NDCs for output on the plotting device is called a **normalization transformation**. The NCAR Graphics GKS-0A package currently supports two normalization transformation types. Type 0 defines an identity transformation in which the WCs, like NDCs, have horizontal and vertical axes ranging from 0. to 1. This is the transformation used to facilitate putting an object such as a title at a specific location on the frame. A type 1 normalization transformation allows the WCs to have whatever range of values is desired.

See "Appendix A: The use of X/Y coordinates in NCAR Graphics" for a complete description of NCAR Graphics coordinate systems.

The graphic shows a normalization transformation from world coordinates to NDCs, in which there is mirror-imaging and nonlinear scaling of axes.

1 CALL SET(VPL,VPR,VPB,VPT,1000.,100.,100.,1000.,2)

CALL SET (VPL, VPR, VPB, VPT, WDL, WDR, WDB, WDT, LS)

**VPL, VPR, VPB, and VPT***Real, Input*---Normalized Device Coordinates (NDCs) that define a viewport. The letters "L," "R," "B," and "T" refer to the left, right, bottom, and top edges of the viewport, respectively. VPL must be less than VPR, and VPB must be less than VPT. All coordinates have values in the range of 0. to 1.**WDL, WDR, WDB, and WDT***Real, Input*---User coordinates that define a window. The letters "L," "R," "B," and "T" refer to the left, right, bottom, and top edges of the window, respectively. Axis reversal (also called mirror-imaging of an axis) is controlled by the order of these values. If WDL is greater than WDR, the X coordinates are mirror-imaged. Similarly, if WDB is greater than WDT, the Y coordinates are mirror-imaged.**LS***Integer, Input*---Specifies the desired combination of linear or logarithmic axis scaling. Possibilities are:**1**Linear X, Linear Y**2**Linear X, Log Y**3**Log X, Linear Y**4**Log X, Log Y

Every call to SET redefines GKS normalization transformation 1 with the new viewport and window coordinates, axis scaling, and axis mirror-imaging. This normalization transformation 1 will be in effect until it is changed by either another SET call or by a call to the GKS routine GSELNT.

**Caution:** If you use GSELNT to define a new normalization transformation, you will still have the mirror-imaging and linear/log scaling established by the last SET call. If the last SET call used nonlinear axis scaling or mirror-imaging of an axis, you may need to do another SET call to alter these settings.

1 CALL GETSET(VPLS,VPRS,VPBS,VPTS,WDLS,WDRS,WDBS,WDTS,LSS) 2 CALL SET(VPL,VPR,VPB,VPT,1000.,100.,100.,1000.,2) 3 CALL SET(VPLS,VPRS,VPBS,VPTS,WDLS,WDRS,WDBS,WDTS,LSS)

CALL GETSET (VPL, VPR, VPB, VPT, WDL, WDR, WDB, WDT, LS)

**VPL, VPR, VPB, and VPT***Real, Output*---Normalized device coordinates of the existing viewport. The letters "L," "R," "B," and "T" refer to the left, right, bottom, and top edges of the viewport, respectively. VPL must be less than VPR, and VPB must be less than VPT.**WDL, WDR, WDB, and WDT***Real, Output*---User coordinates of the existing window. The letters "L," "R," "B," and "T" refer to the left, right, bottom, and top edges of the window, respectively.**LS***Integer, Output*---Current value of the log-scaling parameter.

See "Appendix A: The use of X/Ycoordinates in NCAR Graphics" for a complete description of NCAR Graphics coordinate systems.

Previous Chapter LLUs Home Next Chapter Index