views:

2337

answers:

5
+2  A: 

The R Graphics Gallery has a very similar map which should make for a good starting point. The code is here: www.ai.rug.nl/~hedderik/R/US2004 . You'd need to add a legend with the legend() function.

David Smith
Nice. I keep forgetting that the Graphics Gallery is a really neat resource for these kinds of samples.
ars
+3  A: 

Take a look at the PBSmapping package (see borh the vignette/manual and the demo) and this O'Reilly Data Mashups in R article (unfortunately it is not free of charge but it worth 4.99$ to download, according Revolutions blog ).

Paolo
Its $5 and no DRM which made me more than happy to download on principle alone. Well written with good code, highly recommend!
Stedy
+12  A: 
Eduardo Leoni
oh that looks really great! I was hoping someone had a code example like this. Thanks!
JD Long
hot damn! now with pictures!
JD Long
+4  A: 

Check out the packages

library(sp)
library(rgdal)

which are nice for geodata, and

library(RColorBrewer)

is useful for colouring. The map (link below) is made with those packages and this code:

VegMap <- readOGR(".", "VegMapFile")
Veg9<-brewer.pal(9,'Set2')
spplot(VegMap, "Veg", col.regions=Veg9,
 +at=c(0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5),
 +main='Vegetation map')

'VegMapFile' is a .shp and 'Veg' is the variable displayed. Can probably be done better with a little work. I don`t seem to be allowed to upload image, here is an link to the image:

link text

Ehva
very good info! thank you. When you get a little more reputation you should be able to embed the image.
JD Long
+2  A: 

Hi,

Thought I would add some new information here since there has been some activity around this topic since the posting. Here are two great links to "Choropleth Map R Challenge" on the Revolutions blog:

Choropleth Map R Challenge

Choropleth Challenge Results

Hopefully these are useful for people viewing this question.

All the best,

Jay

Jay
very good idea to add that! Thank you.
JD Long
Thanks JD. There is a ton of map plotting information linked through the Revolutions blog now.
Jay