Geographical heat map in R

2019-01-22 04:16发布

问题:

i want to create a map of the US in R with the states color coded in a heat map type of way based on a metric. I know how to do this using the googleVis api but i can't use the code and without the rollovers it's not that great. what is the quickest way to get this done? i'm familiar with the maps package but i can't get the colors to cooperate. i believe this is called a choropleth map.

回答1:

There is a complete example in the ggplot2 package, see ?map_data.

library(ggplot2)
example(map_data)


回答2:

(hopefully answer may still be helpful for somebody)

RevolutionAnalytics has excellent example of map visualization using spplot() function. Here's image from there:



回答3:

There is a population-driven cloropleth example in the UScensus2000tract package.



标签: r map