Skip to content

Commit

Permalink
FF to colors
Browse files Browse the repository at this point in the history
  • Loading branch information
ramarty committed Nov 30, 2023
1 parent c6a093b commit 387a4db
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Binary file modified .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion R/gt_load_png_as_traffic_raster.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ gt_load_png_as_traffic_raster <- function(filename,
## Image to hex
rimg <- raster::as.raster(img)

google_colours = c("#11d68f", "#ffcf43", "#f24e42", "#a92727")
google_colours = c("#11D68FFF", "#FFCF43FF", "#F24E42FF", "#A92727FF")
#google_colours = c("#63D668FF", "#FF974DFF", "#F23C32FF", "#811F1FFF")

if(traffic_color_dist_thresh == 0){

Expand Down
14 changes: 14 additions & 0 deletions make_readme_figures/testing.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ r <- gt_make_raster(location = c(40.717437418183884, -73.99145764250052),
zoom = 16,
google_key = google_key)

## Plot
r_df <- rasterToPoints(r, spatial = TRUE) %>% as.data.frame()
names(r_df) <- c("value", "x", "y")

ggplot() +
geom_raster(data = r_df,
aes(x = x, y = y,
fill = as.factor(value))) +
labs(fill = "Traffic\nLevel") +
scale_fill_manual(values = c("green2", "orange", "red", "#660000")) +
coord_quickmap() +
theme_void() +
theme(plot.background = element_rect(fill = "white", color="white"))


# Make PNGs --------------------------------------------------------------------
dir.create("~/Desktop/gt_pngs")
Expand Down

0 comments on commit 387a4db

Please sign in to comment.