statePopulationData =
WolframAlpha[
"population of states in the United States", \
{{"PropertyRanking:USStateData", 1}, "ComputableData"}];
statePopulations = Thread[
statePopulationData[[All, 2]] ->
statePopulationData[[All, 3]]];
maxPopulation = Max[statePopulationData[[All, 3]]];
minPopulation = Min[statePopulationData[[All, 3]]];
statePopulationRankings = Thread[
statePopulationData[[All, 2]] ->
statePopulationData[[All, 1]]];
usaMapData =
Import["
http://code.google.com/apis/kml/documentation/us_states.kml",
"Data"][[1]];
states = StringDrop[#, -7] & /@ ("PlacemarkNames" /. usaMapData);
statePolygons = Thread[states -> ("Geometry" /. usaMapData)];
color = ColorData["Temperature"];
stateGraphic[value_, poly_] :=
GraphicsGroup[{EdgeForm[{Thin, Black}], FaceForm[color[value]], poly}]
Color by population ranking
Graphics[stateGraphic @@@
({1 - Rescale[#, {1, 50}] /.
statePopulationRankings,
# /. statePolygons} & /@
states)]
Color by population
Graphics[stateGraphic @@@
({Rescale[#, {minPopulation, maxPopulation}] /.
statePopulations,
# /. statePolygons} & /@ states)]
Bob Hanlon
On Mon, Jun 4, 2012 at 4:20 AM, Hobbs, Sylvia (DPH)
<
sylvia...@state.ma.us> wrote:
> or input in Mathematica = state population rankings
>
> too bad it doesn't automatically create a gradient map like is SAS or STATA.
>
> Sylvia D. Hobbs, MPH
>
> Director of Research & Evaluation
> Bureau of Health Care Safety and Quality
> Massachusetts Department of Public Health
> 99 Chauncy Street, 11th Floor
> Boston MA 02111
> ________________________________________
> From: Bob Hanlon [
hanlo...@gmail.com]
> Sent: Sunday, June 03, 2012 4:02 PM
> To:
math...@smc.vnet.net