boB Rudis
4 years ago
10 changed files with 7377 additions and 0 deletions
@ -0,0 +1,52 @@ |
|||
library(sf) |
|||
library(magick) |
|||
library(tweenr) |
|||
library(rnaturalearth) |
|||
library(hrbrthemes) |
|||
library(tidyverse) |
|||
|
|||
# https://my.vanderbilt.edu/jeremyatack/data-downloads/ |
|||
r1 <- st_read(here::here("data/RR1826-1911Modified0509161/RR1826-1911Modified050916.shp")) |
|||
|
|||
ne_states("United States of America", returnclass = "sf") %>% |
|||
filter(!(name %in% c("Alaska", "Hawaii"))) -> states |
|||
|
|||
border <- st_union(states) |
|||
|
|||
in_op_rng <- sort(unique(r1$InOpBy)) |
|||
|
|||
img <- image_graph(width=1000*2, height=600*2, res=144) |
|||
|
|||
pb <- progress_estimated(length(in_op_rng)) |
|||
|
|||
for (i in in_op_rng) { |
|||
|
|||
pb$tick()$print() |
|||
|
|||
ggplot() + |
|||
geom_sf(data = border, color = "#252525", size = 1, fill = NA) + |
|||
geom_sf(data = states, color = "#b2b2b2", size = 0.1, fill = "white", linetype = "dotted") + |
|||
geom_sf(data = filter(r1, InOpBy <= i), aes(color = InOpBy), size = 0.1) + |
|||
coord_sf(crs = albersusa::us_laea_proj, datum = NA) + |
|||
scale_color_continuous(limits = range(r1$InOpBy)) + |
|||
labs( |
|||
x = NULL, y = NULL, |
|||
title = sprintf("U.S. Railroad Expansion • Year: %s", i), |
|||
subtitle = "The 'Ties' That Bound Us Together", |
|||
caption = "Data source: <my.vanderbilt.edu/jeremyatack/data-downloads/>\nhttps://git.rud.is/hrbrmstr/y2019-30daymapchallenge • #30DayMapChallenge" |
|||
) + |
|||
theme_ipsum_es(grid="") + |
|||
theme(plot.title = element_text(hjust = 0.5)) + |
|||
theme(plot.subtitle = element_text(hjust = 0.5)) + |
|||
theme(panel.background = element_rect(fill = "#b15928")) + |
|||
theme(legend.position = "none") -> gg |
|||
|
|||
print(gg) |
|||
|
|||
} |
|||
|
|||
dev.off() |
|||
|
|||
img <- image_animate(img, ) |
|||
|
|||
image_write(img, "rr.gif") |
@ -0,0 +1 @@ |
|||
UTF-8 |
Binary file not shown.
@ -0,0 +1 @@ |
|||
PROJCS["USA_Contiguous_Albers_Equal_Area_Conic",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Albers"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-96.0],PARAMETER["Standard_Parallel_1",29.5],PARAMETER["Standard_Parallel_2",45.5],PARAMETER["Latitude_Of_Origin",37.5],UNIT["Meter",1.0]] |
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue