We are attempting to create a US heatmap using only zipcode and corresponding values using R. While there are a number of examples that use lat and long data for creating such maps, is there one that will accept zipcodes and colour the corresponding regions on a map ? Preferably using some package that will produce presentation quality images (ggplot2, etc). Thanks in advance, - Raj.

  • 2
    $\begingroup$ You may already know this, but maps with ZIP codes are going to be odd. There are some ZIP codes that are a single building and that have no residents. The largest ZIP code, 89049 is over 800 square miles. What is the purpose of this map? $\endgroup$
    – Peter Flom
    Jun 13 '13 at 11:53
  • $\begingroup$ Estimating income levels in a particular zip $\endgroup$
    – xbsd
    Jun 13 '13 at 13:16
  • 1
    $\begingroup$ xbsd: If you don't get a great answer here, please consider flagging this question for migration to the GIS site: that community tends to be more familiar with zip codes, heat maps, and mapping. $\endgroup$
    – whuber
    Jun 13 '13 at 13:34

Zip codes are not a good level because strictly speaking zip codes are assigned to streets and hence the map is actually a line file rather than polygon.

For mapping purpose, try zip code tabulation areas (ZCTA) by Census Bureau. You can find mapping resources in the link. For most zip codes, it's safe to attribute them the corresponding ZCTA, though lone zip codes may still exist (largely due to the volatility of the postal zip code system and special zip code like @PeterFlom mentioned in the comment). You may find some crosswalk files between zip code and ZCTA (like this) to better recode your data.

Also, see this thread for some technical hints on using R to plot zip code maps.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.