John Lekberg

Chicago Library Locations

Created 2019-07-05.

Locations and density of all Chicago libraries.

I used the City of Chicago's "Libraries - Locations, Hours and Contact Information" dataset, which has location data for libraries. Here's a sketch for my original idea for the graphic:

   DATA: "Libraries - Locations, Hours and Contact Information" (Chicago Open Data)
  TRANS: Latitude, Longitude = decompose Location
  COORD: Mercator Projection
ELEMENT: point for location, label for location
  GUIDE: Title "Chicago Library Locations"
  GUIDE: Map Background

I ended up having trouble figuring out how to put map data into the graphic. I found an interesting webpage, "Making Maps with R", that talked about making maps with R.

My biggest critique of this graphic is that, besides the Illinois-Indiana border, administrative divisions are not really marked, so it's hard to tell where things are. I tried to mitigate this by include a label roughly where the loop is.

I also tried showing the density of the libraries using a hex bin graphic (see hex-bin figure). I initially used a lot of bins, but I found that when I used less bins (so, larger bins overall), I was able to perceive more variation, which makes it easier to see that most of the libraries are just west and south of the loop.

A hex binned variation of the main graphic.

Code used to create "Chicago Library Locations"

code.r - A fragment of the code used to generate the graphic (lost the original code).

df <- read.csv("~/Downloads/Libraries_-_Locations__Hours_and_Contact_Information.csv")

location_re <- "\\(([-0-9.]+), ([-0-9.]+)\\)"

df$LATITUDE <- as.double(sub(location_re, "\\1", df$LOCATION))
df$LONGITUDE <- as.double(sub(location_re, "\\2", df$LOCATION))

state_df <- subset(map_data("state"), region %in% c("illinois", "indiana"))

loop_lon <- -87.6239
loop_lat <- 41.8784

ggplot(df, aes(LONGITUDE, LATITUDE)) +
  geom_point() +
  xlim(-88, -87) +
  ylim(41.4, 42.1) +
  guides(color=FALSE) + 
  ggtitle("Chicago Library Locations") +
  coord_fixed(1) +
  annotate("path", x=state_df$long, y=state_df$lat) +
  annotate("label", x=loop_lon+.1, y=loop_lat, label="The Loop”)