Chapter Contents

Previous

Next
The PLOT Procedure

Example 11: Adjusting Labels on a Plot with the PLACEMENT= Option


Procedure features:
PLOT statement options
label variable in plot request
LIST=
PLACEMENT=
Other features:
RUN group processing

This example illustrates the default placement of labels and how to adjust the placement of labels on a crowded plot. The labels are values of variable in the data set.(footnote 1)

This example also shows RUN group processing in PROC PLOT.


Program

options nodate pageno=1 linesize=120 pagesize=37;

 Note about code
data census;
   input Density CrimeRate State $ 14-27 PostalCode $ 29-30;
   datalines;
263.3 4575.3 Ohio           OH
62.1 7017.1  Washington     WA

...more data lines...

111.6 4665.6 Tennessee      TN
120.4 4649.9 North Carolina NC
;
 Note about code
proc plot data=census;
   plot density*crimerate=state $ state / box list=1
        haxis=by 1000 vaxis=by 250;
   title 'A Plot of Population Density and Crime Rates';
run;





The labels Tennessee, South Carolina, Arkansas, Minnesota, and South Dakota have penalties. The default placement states do not provide enough possibilities for PROC PLOT to avoid penalties given the proximity of the points. Seven label characters are hidden. [HTML Output]
 [Listing Output]
 Note about code
      plot density*crimerate=state $ state / box list=1
           haxis=by 1000 vaxis=by 250




 Note about code
           placement=((v=2 1 : l=2 1)
                 ((l=2 2 1 : v=0 1 0) * (s=right left : h=2 -2))
                 (s=center right left * l=2 1 * v=0 1 -1 2 *
                  h=0 1 to 5 by alt));
   title 'A Plot of Population Density and Crime Rates';
   run;




Output
No collisions occur in the plot. [HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

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