Chapter Contents


The G3D Procedure


Parts of a Three-dimensional Plot

G3D Procedure Terms


About the Input Data Set

The G3D procedure requires data sets that include three numeric variables: two horizontal variables plotted on the x and y axes that define an x-y plane, and a vertical variable plotted on the z axis rising from the { it x-y} plane.

Data for Surface Plots

For surface plots, the observations in the input data set should form an evenly spaced grid of horizontal (x and y) values and exactly one vertical (z) value for each of these combinations. For example, data that contains 5 distinct values for x and 10 distinct values for y should be part of a data set that contains 50 observations with values for x, y, and z.

Only one z point is plotted for each combination of x and y. For example, you cannot draw a sphere using the PLOT statement. If there is more than one observation for a combination of x and y in the data set, only the last such point is used.

For the G3D procedure to produce a satisfactory surface plot, the data set must contain nonmissing z values for at least 50 percent of the grid cells. When the G3D procedure cannot produce a satisfactory surface plot because of missing z values, SAS/GRAPH issues a warning message and a graph may not be produced. To correct this problem, process the data set with the G3GRID procedure and use the processed data set as the input data set for G3D. The G3GRID procedure interpolates the necessary values to produce a data set with nonmissing z values for every combination of x and y. The G3GRID procedure can also smooth data for use with the G3D procedure. See The G3GRID Procedure for more information on the G3GRID procedure.

Data for Scatter Plots

An input data set for scatter plots must include at least two observations that contain different values for each of the three variables that are specified in the plot request so that the G3D procedure can scale the axes. If the data set does not meet these requirements, SAS/GRAPH software issues an error message and no graph is produced.

For scatter plots, only one z value is plotted for a combination of x and y. For example, you cannot draw a sphere using the SCATTER statement. If there is more than one observation for a combination of x and y in the data set, only the last point is used. See Simulating an Overlaid Scatter Plot for information on producing scatter plots with more than one vertical value for each x,y combination.

Changing Data Ranges

By default for both surface plots and scatter plots, the range of the z axis is defined by the minimum and maximum z values in the input data set. Restrict or expand the range of the z axis by using the ZMIN= and ZMAX= options in the PLOT or SCATTER statement. To restrict the range of an x or y axis, use a WHERE statement in the PROC step or a WHERE or IF statement in a DATA step to create a subset of the data set.

Note:    AXIS and LEGEND definitions are not supported by the G3D procedure. Use the Annotate facility or TITLE, FOOTNOTE, and NOTE statements to produce legends, tick mark values, and axis labels. See About Controlling the Axes and SCATTER Statement for information on controlling axis labels and tick mark values with PLOT statement and SCATTER statement options.  [cautionend]

About Rotating and Tilting the Plot

For both surface plots and scatter plots, you can rotate the x-y plane about the z axis, or tilt the plot toward you. When you rotate a plot, you can view data from any angle around the three-dimensional graph. This is useful for bringing into view data points that were previously hidden by other data points on a plot. Tilting a plot enables you to accentuate the location of data points.

Rotating and Tilting a Graph shows how rotating and tilting can change the viewing angle of a graph.

Note:    At certain combinations of tilt and rotation angles, the tick mark values may overlap.  [cautionend]

Rotating and Tilting a Graph


About Controlling the Axes

Because the relationship between a plot's surface and the actual data values can be difficult to interpret, you can improve a graph by changing the number of tick marks on the axes or restricting the range of the vertical (z) variable.

The G3D procedure does not support AXIS definitions; however, you can use PLOT or SCATTER statement options to

You can also change the font and height of axis labels and axis values by specifying the desired font and height with the FTEXT= and HTEXT= options on a GOPTIONS statement.

For information on how to reverse the values on an axis, see Reversing Values on an Axis.

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.