Visualising Urban Geographies was a project by Edinburgh University that iprovided an amazing collection of geo-referenced maps, geographic boundaries and socio econoic maps - Project Website. Here I use some of them to create a vizualizations in R.
library(sf)
library(ggplot2)
library(gganimate)
library(ggpomological)
library(magick)
library(dplyr)
library(readr)
library(ggmap)
Chronological Map of Edinburgh Showing the Expansion of the City 1919 created by John George Bartholomew.
First we are going to load the data.
# load the shp
= st_read("data/spatial/bart_chrono_1919.shp", quiet = TRUE)
chrono_map
#period colors
= c("#851613","#C83B42","#DE7B80","#F0AEB1",
period_colors "#135D89","#4D95BA","#96D1EA","#52442F","#BEB3A1","#F0E7D9")
#period labels
= c("pre 1450","1450 - 1515","1515 - 1622","1622 - 1750",
period_labels "1750 - 1800 ","1800 - 1825","1825 - 1850","1850 - 1875",
"1875 - 1900","since 1900")
Now, we can create the animated map
#plot map for animation
= ggplot() +
map geom_sf(
data = chrono_map,
aes(fill= as.factor(End_Date)),
alpha = 0.75,
colour = NA) +
scale_fill_manual(name = "End of {current_frame}", values = period_colors, labels = period_labels) +
theme_pomological() +
labs(
title = "Chronological Map of Edinburgh",
subtitle = "Showing expansion of the City from earliest days to the present \nby J.G. Bartholomew - Cartographer to the King",
caption = "https://geo.nls.uk/urbhist/"
+
) transition_manual(End_Date, cumulative = T)
# plot static map
= ggplot() +
map geom_sf(
data = chrono_map,
aes(fill= as.factor(End_Date)),
alpha = 0.75,
colour = NA) +
scale_fill_manual(name = "period ", values = period_colors, labels = period_labels,
guide = guide_legend(
direction = 'horizontal',
title.position = 'top',
title.hjust = .5,
label.position = 'bottom',
label.hjust = .5,
keywidth = .5,
keyheight = .5,
nrow = 1
+
))labs(
title = "Chronological Map of Edinburgh",
subtitle = "Showing expansion of the City from earliest days to the present \nby J.G. Bartholomew - Cartographer to the King",
caption = "Source: https://geo.nls.uk/urbhist/"
+
) theme_pomological() +
theme(
legend.position = "bottom"
+
) transition_manual(End_Date, cumulative = T)
#create animation
animate(map, width = 800, height = 600)
#save gif
anim_save("map_anim.gif", map, width = 800,height = 600)
Here we will map a selection of Edinburgh professions in 1911.
= read_csv("data/processed/occupations.csv")
occupations_edi
= qmplot(
base_plot data = occupations_edi,
x = long,
y = lat,
zoom = 14,
geom = "blank",
maptype = "toner-lines",
source = 'stamen'
)
+
base_plot geom_point(mapping = aes(x = long, y = lat), size = .5) +
labs(
title = "Edinburgh Occupations in 1911",
caption = "Source: vug | @topographos2"
+
) theme_pomological(
+
) theme(
axis.title.x=element_blank(),
axis.title.y=element_blank()
+
) facet_wrap(~ occupation)
Short and sweet !
sessionInfo()
## R version 4.0.2 (2020-06-22)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Mojave 10.14.6
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] ggmap_3.0.0.902 readr_1.4.0 dplyr_1.0.2
## [4] magick_2.3 ggpomological_0.1.2 gganimate_1.0.5
## [7] ggplot2_3.3.2 sf_0.9-6
##
## loaded via a namespace (and not attached):
## [1] progress_1.2.2 tidyselect_1.1.0 xfun_0.22
## [4] purrr_0.3.4 lattice_0.20-41 colorspace_1.4-1
## [7] vctrs_0.3.6 generics_0.1.0 htmltools_0.5.1.1
## [10] yaml_2.2.1 rlang_0.4.10 e1071_1.7-4
## [13] pillar_1.4.7 glue_1.4.2 withr_2.3.0
## [16] DBI_1.1.0 tweenr_1.0.1 sp_1.4-5
## [19] jpeg_0.1-8.1 lifecycle_0.2.0 plyr_1.8.6
## [22] stringr_1.4.0.9000 munsell_0.5.0 gtable_0.3.0
## [25] RgoogleMaps_1.4.5.3 evaluate_0.14 labeling_0.4.2
## [28] knitr_1.31 curl_4.3 class_7.3-17
## [31] gifski_0.8.6 highr_0.8 Rcpp_1.0.6
## [34] KernSmooth_2.23-17 scales_1.1.1 classInt_0.4-3
## [37] farver_2.0.3 rjson_0.2.20 hms_0.5.3
## [40] png_0.1-7 digest_0.6.27 stringi_1.5.3
## [43] grid_4.0.2 cli_2.3.1 tools_4.0.2
## [46] bitops_1.0-6 magrittr_2.0.1 tibble_3.0.4
## [49] tidyr_1.1.2 crayon_1.4.1 pkgconfig_2.0.3
## [52] ellipsis_0.3.1 prettyunits_1.1.1 rstudioapi_0.13
## [55] assertthat_0.2.1 rmarkdown_2.6.4 httr_1.4.2
## [58] R6_2.5.0 units_0.6-7 compiler_4.0.2
A work by Michal Michalski