Fast zip code map

[click to enlarge]

I’ve recently been playing around with the ggmap package in R and was able to quickly put together a bubble chart version of student home zip codes.  As you can see from the two legends, the size and color both reflect the number of students in these zip codes.

I will certainly be playing around with ggmaps so more as this map required only two lines of code (after the ggmap library was loaded).


usmap<-qmap(‘united states’, zoom=4, source=’osm’,extent=’panel’)

usmap+geom_point(aes(x=X, y=Y, size=COUNT, color=COUNT), data=DATA, alpha=.5)


5 thoughts on “Fast zip code map”

  1. Thanks for this example! I’m new to using R, got it all installed and packages loaded, but could you give a little more info on getting your script to work?
    I’m getting the errors:
    usmap<-qmap(‘united states’, zoom=4, source=’osm’,extent=’panel’)
    Error: unexpected input in "usmap usmap+geom_point(aes(x=X, y=Y, size=COUNT, color=COUNT), data=DATA, alpha=.5)
    Error: object ‘usmap’ not found

  2. I got a little further – was having problems with slanty quote characters from cut and paste!

  3. Hi Alex – my remaining question is that I need some guidance on how to import my data. I basically have a list of zipcodes. Could you guide me on the import process and how to geocode the zipcodes for lat and lon?

Comments are closed.