Sample 38060: Label specific points on a graph with PROC GPLOT
This sample uses the LABEL function in an Annotate data set to label only points on a graph that meet specific criteria.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample uses the LABEL function in an Annotate data set to label only points on a graph that meet specific criteria.
The graphics output in the Results tab was produced using SAS® 9.2. Submitting the sample code with releases of SAS prior to SAS 9.2 might produce different results.
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
/* Create an annotate data set to place labels */
/* on points that meet specific criteria. */
data anno;
length function color $8;
retain xsys ysys '2' when 'a';
set sashelp.class;
/* Label only those points where the */
/* height is greater than 65 inches. */
if height gt 65 then do;
function='label';
x=weight;
y=height;
color='black';
position='2';
text=trim(left(put(height,6.1)));
output;
end;
run;
title1 "Label Specific Points on a Graph";
/* Generate the graph. */
proc gplot data=sashelp.class;
plot height*weight / haxis=axis1 vaxis=axis2
vref=65 lvref=20 cvref=depk
annotate=anno;
symbol1 interpol=none value=dot color=vibg h=1.2;
axis1 label=("Weight in pounds") offset=(2,2)pct;
axis2 label=(angle=90 "Height in inches")
order=(50 to 80 by 5) minor=(n=4);
run;
quit;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample uses an Annotate data set to label specific points on a graph.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GPLOT Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Annotation
|
Date Modified: | 2009-12-07 14:02:41 |
Date Created: | 2009-12-07 13:29:18 |
Operating System and Release Information
SAS System | SAS/GRAPH | Microsoft Windows 2000 Advanced Server | 9 TS M0 | |
Microsoft Windows 2000 Datacenter Server | 9 TS M0 | |
Microsoft Windows 2000 Server | 9 TS M0 | |
Microsoft Windows 2000 Professional | 9 TS M0 | |
Microsoft Windows NT Workstation | 9 TS M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Standard Edition | 9 TS M0 | |
Microsoft Windows XP Professional | 9 TS M0 | |
64-bit Enabled AIX | 9 TS M0 | |
64-bit Enabled HP-UX | 9 TS M0 | |
64-bit Enabled Solaris | 9 TS M0 | |
HP-UX IPF | 9 TS M0 | |
Linux | 9 TS M0 | |
OpenVMS Alpha | 9 TS M0 | |
Tru64 UNIX | 9 TS M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9 TS M0 | |
z/OS | 9 TS M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9 TS M0 | |