Previous Page | Next Page

The PLOT Procedure

Example 13: Changing a Default Penalty


Procedure features:

PLOT statement option

PENALTIES=

Data set: CENSUS

This example demonstrates how changing a default penalty affects the placement of labels. The goal is to produce a plot that has labels that do not detract from how the points are scattered.


Program

 Note about code
options nodate pageno=1 linesize=120 pagesize=37;
 Note about code
   proc plot data=census;
      plot density*crimerate=state $ state /
 Note about code
           placement=(h=100 to 10 by alt * s=left right)
 Note about code
           penalties(4)=500  list=0
 Note about code
           haxis=0 to 13000 by 1000 
           vaxis=by 100;
 Note about code
   title 'A Plot of Population Density and Crime Rates';
run;

Output

                                      A Plot of Population Density and Crime Rates                                     1

                              Plot of Density*CrimeRate$State.  Symbol is value of State.

 Density |
     500 +
         |
         |
         |
         |                                              M                                                      Maryland
     400 +
         |
         |
         |
         |
     300 +                                          D                                                          Delaware
         |
         |                           P           O                                                    Pennsylvania Ohio
         |
         |
     200 +                                             I                                                       Illinois
         |Florida                                                               F
         |                                                      C                                            California
         |
         |                                       T                                             North Carolina Tennessee
     100 +Georgia                      N             S    G                                New Hampshire South Carolina
         |                    W                 A M                                      Alabama Missouri West Virginia
         |Washington Texas              M     V  M                  W     T               Vermont Minnesota Mississippi
         |Oklahoma                            A             O                                                  Arkansas
         |Oregon                             I                      O                                             Idaho
       0 +                       S N                           N                       North Dakota South Dakota Nevada
         ---+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+--
            0     1000    2000    3000    4000    5000    6000    7000    8000    9000    10000   11000   12000   13000

                                                            CrimeRate

NOTE: 1 obs hidden.
                                      A Plot of Population Density and Crime Rates                                     2

                               List of Point Locations, Penalties, and Placement States
 
                               Vertical   Horizontal             Starting           Vertical   Horizontal
              Label                Axis         Axis   Penalty   Position   Lines      Shift        Shift

              Maryland           428.70       5477.6         0   Right          1          0           55
              Delaware           307.60       4938.8         0   Right          1          0           59
              Pennsylvania       264.30       3163.2         0   Right          1          0           65
              Ohio               263.30       4575.3         0   Right          1          0           66
              Illinois           205.30       5416.5         0   Right          1          0           56
              Florida            180.00       8503.2         0   Left           1          0          -64
              California         151.40       6506.4         0   Right          1          0           45
              Tennessee          111.60       4665.6         0   Right          1          0           61
              North Carolina     120.40       4649.9         0   Right          1          0           46
              New Hampshire      102.40       3371.7         0   Right          1          0           52
              South Carolina     103.40       5161.9         0   Right          1          0           52
              Georgia             94.10       5792.0         0   Left           1          0          -42
              West Virginia       80.80       2190.7         0   Right          1          0           76
              Alabama             76.60       4451.4         0   Right          1          0           41
              Missouri            71.20       4707.5         0   Right          1          0           47
              Mississippi         53.40       3438.6         0   Right          1          0           68
              Vermont             55.20       4271.2         0   Right          1          0           44
              Minnesota           51.20       4615.8         0   Right          1          0           49
              Washington          62.10       7017.1         0   Left           1          0          -49
              Texas               54.30       7722.4         0   Left           1          0          -49
              Arkansas            43.90       4245.2         0   Right          1          0           65
              Oklahoma            44.10       6025.6         0   Left           1          0          -43
              Idaho               11.50       4156.3         0   Right          1          0           69
              Oregon              27.40       6969.9         0   Left           1          0          -53
              South Dakota         9.10       2678.0         0   Right          1          0           67
              North Dakota         9.40       2833.0         0   Right          1          0           52
              Nevada               7.30       6371.4         0   Right          1          0           50

Previous Page | Next Page | Top of Page