[R] gmaps, projection, inset

John P. Burkett burkett at uri.edu
Sun Aug 3 17:59:21 CEST 2008


Running R version 2.6.1 under Gentoo Linux, I'm trying to produce a 
thematic map of the USA using the gmaps package.  The result thus far 
has two problems from my point of view.

First, the projection (Miller cylindrical?) elongates southern states 
and flattens northern ones unattractively. I'd prefer Albers conic 
projection or something similar.

Second, the inset for Alaska is placed south of the contiguous states. 
I'd prefer to put it north of them.

I would be very grateful to anyone who could suggest (a) how to change 
the projection and/or (b) relocate the inset.

The most relevant section of my R code is pasted below. If needed, I can 
supply the entire program and data.

-John

*****************Code starts here*************************
library(gmaps)
grid.newpage()
grid.frame(name="map")
statenames <- list("Alabama", "Alaska", "Arizona", "Arkansas",
              "California", "Colorado", "Connecticut",
              "Florida", "Georgia", "Hawaii", "Idaho",
              "Illinois", "Indiana", "Iowa", "Kansas",
              "Kentucky", "Louisiana", "Maine", "Maryland",
              "Massachusetts", "Michigan", "Minnesota", "Mississippi",
              "Missouri", "Montana", "Nebraska", "Nevada",
              "New Hampshire", "New Jersey", "New Mexico", "New York",
              "North Carolina", "North Dakota", "Ohio", "Oklahoma",
              "Oregon", "Pennsylvania", "Rhode Island", "South Carolina",
              "South Dakota", "Tennessee", "Texas", "Utah",
              "Vermont", "Virginia", "Washington", "West Virginia",
              "Wisconsin", "Wyoming", "Delaware") # Delaware is last 
because it has a missing value and should not be shaded on map.
grid.pack("map",USALevelPlot(states=statenames,levels=spc,col.fun=greens,normalize=T),height=unit(1,'null')) 

*****************Code ends here***************************



-- 
John P. Burkett
Department of Environmental and Natural Resource Economics
and Department of Economics
University of Rhode Island
Kingston, RI 02881-0808
USA

phone (401) 874-9195



More information about the R-help mailing list