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).

R CODE:

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)

HAPPY HOLIDAYS!

This entry was posted in Miscellanea. Bookmark the permalink.

3 Responses to Fast zip code map

  1. Eric Hilfer says:

    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. Eric Hilfer says:

    I got myself straightened out. I’ll post my script when I’m done!
    Thanks,
    Eric