Skip to content

Instantly share code, notes, and snippets.

@revodavid
Last active February 27, 2016 04:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save revodavid/2bb5f1d45129f23c3527 to your computer and use it in GitHub Desktop.
Save revodavid/2bb5f1d45129f23c3527 to your computer and use it in GitHub Desktop.
## source: https://github.com/toddwschneider/nyc-taxi-data/blob/master/analysis/analysis.R
dropoffs = query("SELECT * FROM dropoff_by_lat_long_cab_type ORDER BY count")
dropoffs = mutate(dropoffs, cab_type_id = factor(cab_type_id))
p = ggplot() +
geom_polygon(data = ex_staten_island_map,
aes(x = long, y = lat, group = group),
fill = "#080808", color = "#080808") +
geom_point(data = dropoffs,
aes(x = dropoff_long, y = dropoff_lat, alpha = count, size = count, color = cab_type_id)) +
scale_alpha_continuous(range = alpha_range, trans = "log", limits = range(dropoffs$count)) +
scale_size_continuous(range = size_range, trans = "log", limits = range(dropoffs$count)) +
scale_color_manual(values = c("#ffffff", green_hex)) +
coord_map(xlim = range(ex_staten_island_map$long), ylim = range(ex_staten_island_map$lat)) +
title_with_subtitle("New York City Taxi Drop Offs", "2009–2015") +
theme_dark_map(base_size = 24) +
theme(legend.position = "none")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment