library(sf)
library(ggplot2)
library(ggrepel)
library(stringr)
library(scales)
map <- read_sf("data/taxi_zones/taxi_zones.shp") |>
clean_names() |>
left_join(airport_pickups,
by = c("zone" = "dropoff_zone")) |>
arrange(desc(n))
arrow_r_together <- ggplot(data = map, aes(fill = n)) +
geom_sf(size = .1) +
scale_fill_distiller(
name = "Number of trips",
labels = label_comma(),
palette = "Reds",
direction = 1
) +
geom_label_repel(
stat = "sf_coordinates",
data = map |>
mutate(zone_label = case_when(
str_detect(zone, "Airport") ~ zone,
str_detect(zone, "Times") ~ zone,
.default = ""
)),
mapping = aes(label = zone_label, geometry = geometry),
max.overlaps = 60,
label.padding = .3,
fill = "white"
) +
theme_void()