Mapping San Francisco crime

When I was working as a data scientist at Apple in Silicon Valley, I’d drive up to San Francisco on nights and weekends to meet a girl for dinner or go to a meetup.

I sort of fell in love with the city, and have recently been checking out datasets on DataSF so I could do some geospatial visualizations of San Francisco.

As it turns out, much like Chicago, and Philadelphia, crime data is readily available. So, I downloaded the crime data and started visualizing in R using ggplot2.

The above is a map is the result. It’s a map of 2014 SF crime data through mid December.

What’s remarkable is that the plotting code (the code that creates the map itself) is only 12 lines of code. And of those 12, the vast majority of the code is just formatting and subtle tweaks to aesthetic features to give it the look I wanted. (The look-and-feel of it was originally inspired by a map of London bike and pollution data at spatial.ly.)