John Lekberg

Crime in Chicago

Created 2019-06-19.

Density of crime in Chicago for 2017 and 2018.

I used the City of Chicago's "Crimes - 2001 to Present" dataset, which has location data for reported crimes. My idea was to show crime in the city, year over year.

Here's a sketch of my initial graphic spec:

   DATA: Chicago Public Data "Crimes - 2001 to Present"
  COORD: rectangular on dimensions 1 and 2, facet by year
ELEMENT: binned hexagons at (Longitude, Latitude),
         hue by density of data
  GUIDE: Legend for interpreting binned hexagon hue
  GUIDE: Title "Crimes in Chicago (Year over Year) 2001 to Present"
  GUIDE: Label each facet by year

I learned that ggplot doesn't handle a ton of data that well.

The crime is very concentrated near the Loop, so I zoomed in by restricting the graphic g to see if there were better details (see zoomed figure).

g + xlim(-87.65, -87.6) + ylim(41.87, 41.9)

The amount of crime in the Loop overwhelms the rest of the map. My instinct is that this makes the graphic bad because it means we can't really get a sense of crime elsewhere in the city, but I also think that it does a great job illustrating how much crime takes place in the Loop.

Another thing I noticed with the graphic is that there are holes in the coverage. But those are distracting, so how should I deal with that? Thoughts:

I also wonder if there is a good way to get "year minus year" values in a hexagon grid.

A zoom-in of the main graphic.

Code used to create "Crime in Chicago"

code.r - A fragment of the code used to produce the graphic (lost the original code).
ggplot(df, aes(Longitude, Latitude)) +
    geom_hex() +
    facet_grid(strftime(Date, format="%Y") ~ .) +