Graphics Programs Reference
In-Depth Information
Now on to mapping. When you create your maps, it's useful to think of
them as layers (regardless of the software in use). The bottom layer is
usually the base map that shows geographical boundaries, and then you
place data layers on top of that. In this case the bottom layer is a map of
the United States, and the second layer is Costco locations. Here's how to
make the first layer, as shown in Figure 8-2.
map(database=”state”)
FIGurE 8-2 Plain map of the United States
The second layer, or Costco's, are then mapped with the symbols() func-
tion. This is the same function you used to make the bubble plots in Chap-
ter 6, “Visualizing Relationships,” and you use it in the same way, except
you pass latitude and longitude instead of x- and y-coordinates. Also set
add to TRUE to indicate that you want symbols to be added to the map rather
than creating a new plot.
symbols(costcos$Longitude, costcos$Latitude,
circles=rep(1, length(costcos$Longitude)), inches=0.05, add=TRUE)
Figure 8-3 shows the results. All the circles are the same size because
you set circles to an array of ones with the length equal to the number
of locations. You also set inches to 0.05, which sizes the circles to that
number. If you want smaller markers, all you need to do is decrease that
value.
Search WWH ::




Custom Search