The data is available for download at http://data.seattle.gov. I thought it would be an interesting project to try to plot all of the bicycle racks on a map. The city of Seattle’s website does offer a map that shows all of the racks; however, all of the racks are displayed equally. My graph displays the racks by size. The more bikes a rack can hold, the larger the dot on the map. I have also included various versions of the same map. Some are super cool.

I used the packages dyplr and rbokeh. The style of the map comes from Snazzy Maps http://snazzymaps.com.

library(rbokeh)
suppressMessages(library(dplyr))
bike <- read.csv("~/Documents/datasets/City_of_Seattle_Bicycle_Racks.csv")
bike_small <- bike %>% select(LATITUDE, LONGITUDE, RACK_CAPAC)
bike_small %>% head
##   LATITUDE LONGITUDE RACK_CAPAC
## 1  47.6237 -122.3072          2
## 2  47.6200 -122.3204          2
## 3  47.6089 -122.3288          2
## 4  47.6243 -122.3179          2
## 5  47.6247 -122.3267          2
## 6  47.6319 -122.3085          2

For the graph, I used the function gmap from the package rbokeh. Notice that if you hover over the dots, the capacity of the rack is displayed. You can turn off the hover capability. You can also zoom in with the zoom wheel, above each plot.

gmap(lat = 47.6125467, lng = -122.2968904, zoom = 11,
     width = 600, height = 800, map_type = "road_map") %>%
  ly_points(LONGITUDE, LATITUDE, data = bike_small,
            fill_alpha = 0.5, size = 1.25*RACK_CAPAC, color = "black",
            hover = c(RACK_CAPAC))

gmap(lat = 47.6125467, lng = -122.2968904, zoom = 11,
     width = 600, height = 800, map_style = gray_scale) %>%
  ly_points(LONGITUDE, LATITUDE, data = bike_small,
            fill_alpha = 0.5, size = 1.25*RACK_CAPAC, color = "black",
            hover = c(RACK_CAPAC))

gmap(lat = 47.6125467, lng = -122.2968904, zoom = 11,
     width = 600, height = 800, map_style = NoweInwestycje) %>%
  ly_points(LONGITUDE, LATITUDE, data = bike_small,
            fill_alpha = 0.5, size = 1.25*RACK_CAPAC, color = "white",
            hover = c(RACK_CAPAC))

gmap(lat = 47.6125467, lng = -122.2968904, zoom = 11,
     width = 600, height = 800, map_style = scorched_earth) %>%
  ly_points(LONGITUDE, LATITUDE, data = bike_small,
            fill_alpha = 0.5, size = 1.25*RACK_CAPAC, color = "blue",
            hover = c(RACK_CAPAC))

gmap(lat = 47.6125467, lng = -122.2968904, zoom = 11,
     width = 600, height = 800, map_style = Orangina) %>%
  ly_points(LONGITUDE, LATITUDE, data = bike_small,
            fill_alpha = 0.5, size = 1.25*RACK_CAPAC, color = "blue",
            hover = c(RACK_CAPAC))