Skip to content

Commit

Permalink
README pushed
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancday committed Apr 11, 2019
1 parent ba56eb2 commit cfac1b6
Show file tree
Hide file tree
Showing 43 changed files with 52 additions and 13 deletions.
15 changes: 15 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
output: github_document
---

## Leveraging Transit Data for Urban Developmen
#### TomTom Machine Learning Conference 2019

This is the repo with code to build by presentation.

Everything is done with R.

[Slide show](https://docs.google.com/presentation/d/1yUQ3eXNbgkGOXoxn_ksc5yCcQyzK7VvjD9tqYuOxGVU/edit?usp=sharing)

[CAT Ridership Data](https://drive.google.com/file/d/1ckMeT_JWGukqQt_GMmdnJ7NY4Sr1RaLF/view?usp=sharing) - This is tabular data in a TXT file.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

## Leveraging Transit Data for Urban Developmen

#### TomTom Machine Learning Conference 2019

This is the repo with code to build by presentation.

Everything is done with R.

[Slide
show](https://docs.google.com/presentation/d/1yUQ3eXNbgkGOXoxn_ksc5yCcQyzK7VvjD9tqYuOxGVU/edit?usp=sharing)

[CAT Ridership
Data](https://drive.google.com/file/d/1ckMeT_JWGukqQt_GMmdnJ7NY4Sr1RaLF/view?usp=sharing)
- This is tabular data in a TXT file.
Binary file removed Rplot.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added images/slide 8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/slide1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added images/slide2.6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added images/slide5.5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added images/slide9.png
File renamed without changes
File renamed without changes
File renamed without changes
35 changes: 22 additions & 13 deletions src/deck_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,28 +127,34 @@ cowplot::plot_grid(key_map, trend_plot, rel_widths = c(.3, .6))
# alpha'd to show show bigs

cvl_geo %<>%
mutate(alpha2 = case_when(grepl("(900)|(502)|(201)|(402)", GEOID) ~ 1,
TRUE ~ .8))
mutate(color = case_when(grepl("(900)|(502)|(201)|(402)", GEOID) ~ GEOID,
TRUE ~ "GREY"))

key_map <- ggplot(cvl_geo) +
geom_sf(aes(fill = GEOID, alpha = alpha2, stroke = alpha), show.legend = F) +
ggsci::scale_fill_d3("category20") +
geom_sf(aes(fill = color, stroke = alpha), show.legend = F) +
scale_fill_manual(values = d3_pal2) +
scale_alpha(range = c(.25, 1)) +
coord_sf(datum = NA)

key_map

cvl %<>%
mutate(alpha2 = case_when(grepl(""(900)|(502)|(201)|(402)"", GEOID) ~ 1,
TRUE ~ .8))
mutate(color = case_when(grepl("(900)|(502)|(201)|(402)", GEOID) ~ GEOID,
TRUE ~ "GREY"))

d3_pal2 <- ggsci::pal_d3("category20")(12) %>%
set_names(cvl_geo$GEOID)

trend_plot <- ggplot(cvl, aes(last_year, estimate, color = GEOID, group = GEOID)) +
geom_path(aes(alpha = alpha2), size = 2, show.legend = F) +
ggsci::scale_color_d3("category20") +
geom_path(aes(color = color), size = 2, show.legend = F) +
scale_color_manual(values = d3_pal2) +
scale_y_continuous(labels = scales::dollar) +
scale_alpha(range = c(.25, 1)) +
labs(y = "Median Rent",
x = NULL)

trend_plot

cowplot::plot_grid(key_map, trend_plot, rel_widths = c(.3, .6))

# Slide 3 -----------------------------------------------------------------
Expand Down Expand Up @@ -386,8 +392,9 @@ commute_routes %>%
coord_flip() +
scale_fill_manual(values = pal) +
scale_y_continuous(labels = function(breaks) breaks / 1000) +
theme(legend.position = "none") +
labs(y = "Thousands riders",
theme(legend.position = "none",
axis.text = element_text(size = rel(1.2))) +
labs(y = "Thousand riders",
x = NULL,
caption = "M-F 7a-9a")

Expand Down Expand Up @@ -506,12 +513,14 @@ leaflet(shapes_by_stops) %>%
shapes_by_stops %>%
ggplot(aes(x = Assessment, y = total_wt, color = total_wt)) +
geom_point(size = 3, alpha = .3) +
geom_vline(xintercept = 4.5e5, linetype = 2) +
geom_hline(yintercept = 1, linetype = 2) +
geom_rect(xmin = 0, xmax = 1e6, ymin = -.5, ymax = 1,
alpha = .01, aes(color = NULL), fill = "lightgrey") +
geom_rect(xmin = 4e5, xmax = 1.02e6, ymin = -.5, ymax = 5.5,
alpha = .01, aes(color = NULL), fill = "lightgrey") +
scale_x_continuous(labels = scales::dollar) +
scale_color_viridis_c() +
labs(x = NULL,
y = "CAT weight") +
y = "Transit score") +
theme(legend.position = "none",
axis.text = element_text(size = rel(1.1)))

Expand Down
Binary file removed src/images/slide 8.png
Diff not rendered.
Binary file removed src/images/slide1.png
Diff not rendered.
Binary file removed src/images/slide2.6.png
Diff not rendered.
Binary file removed src/images/slide5.5.png
Diff not rendered.
Binary file removed src/images/slide9.png
Diff not rendered.

0 comments on commit cfac1b6

Please sign in to comment.