Click here to see the SAS code.
Click here to see the example.
This map has been referred to as an annotate "Tour de Force" ;-)
I was trying to get this to look exactly like a map I had seen on the
US Census website, therefore I use a lot of hard-coded annotate, to
get the text and other peices into the exact/desired position.
I start with the good-old sas/graph "maps.us" map data set,
and then I assign regions & divisions to each state, and I apply
some x/y offsets to groups of states so they will appear to have
some exploded/space between them.
Since I have moved the states with x/y offsets, I can't use the
x/y coordinates for the centers of the states in maps.uscenter,
and therefore I calculate an "average" x/y center for each state,
and use that location to annotate the state abbreviation.
Similarly, I create "average" x/y centers for the divisions,
and annotate the division names. For the regions I just hardcode
some x/y coordinates (since they are not visually centered within
a group of states).
I create a dark outline around the groups of states, by "greducing"
to remove the internal borders, and then converting the x/y coordinates
for the remaining outline into an annotate polygon.
I draw boxes around alaska and hawaii using annotated polygon lines.
And, I use thick line segments to represent the miles "legend" key
in these boxes (these were just eye-balled, and are not guaranteed
to be correct).
The title is also annotated, rather than using gmap's built-in title.
This allows me to position the title within the same x/y space
as the map (it overlaps the same space as alasks), and thereby
makes better use of the white space.
In the footnote at the bottom of the page, I use the link= option to
add a drilldown to the census website containing the map I was
imitating. Also, I use a blank footnote1 and footnote3 to add some
whitespace around the footnote2.
And, for the finishing touch, I use gmap's "html=" option to add
html charttip/flyover-text to each state, so you can mouse over it
and see the state name, division, and region. And I add a href drilldown
so that you drilldown to the census page for that state if you click
on the state.
Back to Samples Index