| Overview |
The GTL uses various criteria to determine the displayed axis features for a graph. Generally, axis features are based on the layout type, the order of plot statements in the layout and the options specified on those statements, the use of primary and secondary axes on the plots (when secondary axes are supported), the plot type, the column(s) of data that contribute to defining the axis range, and the data formats for the contributing data columns.
Depending on the layout type, 2D plots may have up to four independent axes that can be displayed: X, Y, X2, and Y2. By default, the X2 and Y2 axes are not displayed; if requested, they are duplicates of the X and Y axes unless their characteristics are specifically set. The following template defines a separate label for each of the four axes in a 2D plot:
proc template;
define statgraph axes2d;
begingraph;
layout overlay /
xaxisopts= (label="X axis" displaysecondary=all)
yaxisopts= (label="Y axis" displaysecondary=all)
x2axisopts=(label="X2 axis")
y2axisopts=(label="Y2 axis");
bandplot x=x limitupper=upper limitlower=lower /
display=(fill);
seriesplot x=x y=y;
endlayout;
endgraph;
end;
run;
![]() |
If any data are explicitly mapped to the X2 or Y2 axes, these axes are automatically displayed (assuming the layout supports them). In the following example, the first histogram's frequency counts are mapped to the Y2 axis and the percentages are mapped to the Y axis.
proc template;
define statgraph y2axis;
begingraph;
layout overlay;
histogram weight / scale=count yaxis=y2;
histogram weight / scale=percent yaxis=y;
densityplot weight / normal();
endlayout;
endgraph;
end;
run;
![]() |
3D plots display the standard X, Y, and Z axes. The following template defines a separate label for each axis in a 3D plot:
proc template;
define statgraph axes3d;
begingraph;
layout overlay3d /
xaxisopts=(label="X axis")
yaxisopts=(label="Y axis")
zaxisopts=(label="Z axis")
rotate=25 zoom=.6 tilt=45 cube=false;
surfaceplotparm x=x y=y z=z;
endlayout;
endgraph;
end;
run;
![]() |
Axes can be of different types: LINEAR, DISCRETE, TIME, and LOG. Each type supports many different options. In the following example, the X axis values have the year portion split from the month portion to conserve tick labeling space. The Y axis values are very large. A factor of
(billion) was extracted and placed in the axis label automatically.
proc template;
define statgraph timeaxis;
begingraph;
layout overlay /
xaxisopts=(type=time
timeopts=(tickvalueformat=monyy7.
splittickvalue=true interval=quarter))
yaxisopts=(type=linear
linearopts=(tickvalueformat=(extractscale=true)));
seriesplot x=date y=budget;
endlayout;
endgraph;
end;
run;
![]() |
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.