Exploring Data in Two Dimensions |
Example: Create a Polygon Plot |
In this section you create a polygon plot of the lat and lon variables of the States48 data set. The lat variable gives the latitude of state boundaries for the lower 48 contiguous United States. The lon variable gives the corresponding longitude.
To create a polygon plot:
Open the States48 data set.
Select Graph Polygon Plot from the main menu, as shown in Figure 6.20.
The Polygon Plot dialog box appears. (See Figure 6.21.)
Select the lon variable, and click Set X.
Select the lat variable, and click Set Y.
Select the state variable. Hold down the CTRL key and select the segment variable. Click Add ID.
Click OK.
Note:The order of the ID variables is important. The second variable should be nested in the first variable.
A polygon plot appears (similar to Figure 6.24) that shows the contiguous 48 United States. The color of a region (in this example, a state) is determined by the first observation encountered for that region. The observation’s fill color determines the color of the interior of the polygon; the outline color determines the color of the region’s outline.
For these data, the observations are all black. To make the polygon plot look more like a map, you can color observations by the value of the state variable.
Right-click near the center of the plot, and select Plot Area Properties from the pop-up menu.
The Plot Area Properties dialog box appears. (See Figure 6.22.)
Click the Observations tab, as shown in Figure 6.23.
Select state from the Fill: Blend menu.
Click OK.
The polygon plot is now colored according to your choice of color map. (See Figure 6.24.)
The polygon plot supports the selection of polygonal regions. For example, you can click a state to select the observations that define the boundary of that state. You can click while holding down the CTRL key to select observations that define multiple states. You can also draw a selection rectangle to select observations that define contiguous states.
If a state is composed of two or more components, you can click each component independently. For example, you can select just the upper peninsula of Michigan, or select only Long Island, New York. You can also color each region independently.
Copyright © SAS Institute, Inc. All Rights Reserved.