/
Day_02.R
58 lines (51 loc) 路 2.09 KB
/
Day_02.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
### #30DayMapChallenge 2021 ###
## Day 2, Lines
# packages
library(tidyverse)
library(sf)
library(ggtext)
library(patchwork)
# load AIS tracking data downloaded from:
# https://data.gov.uk/dataset/963c1a7b-5b72-4cce-93f5-3f1e223fd575/anonymised-ais-derived-track-lines-2015
tracks <- st_read(here::here("data", "Anonymised_AIS_Derived_Track_Lines_2015_MMO", "Anonymised_AIS_Derived_Track_Lines_2015_MMO.shp")) %>%
st_transform(3857)
# plot
track_plot <-
ggplot() +
geom_sf(data = tracks,
alpha = 0.02,
size = 0.1,
colour = "#FCFDBF") +
coord_sf() +
scale_x_continuous(limits = c(-1100000, 784500),
expand = c(0, 0)) +
scale_y_continuous(limits = c(6000000, 8620000),
expand = c(0, 0)) +
theme_void() +
theme(plot.background = element_rect(fill = "#0C2330",
colour = NA),
panel.background = element_rect(fill = "#0C2330",
colour = NA),
plot.margin = margin(0, 0, 0, 0))
title_plot <-
ggplot() +
labs(title = "Britain's Shipping Routes",
subtitle = "<span style = 'font-size: 27.1px'>AIS derived vessel track lines from 2015</span><br><br><br><span style = 'font-size: 13.4px'>#30DayMapChallenge | Day 2, Lines | Visualisation: Joshua Copping | Data: MMO</span>") +
theme(plot.background = element_rect(fill = NA,
colour = NA),
panel.background = element_rect(fill = NA,
colour = NA),
plot.title = element_text(family = "Roboto Black",
size = 32,
colour = "grey90"),
plot.subtitle = element_markdown(family = "Roboto",
colour = "grey90"))
lines_plot <- track_plot +
inset_element(title_plot, 0.45, 0, 0.95, 0.12) +
plot_annotation(theme = theme(plot.margin = margin(0, 0, 0, 0)))
# save
ggsave(plot = lines_plot,
here::here("maps", "Day02.png"),
width = 10,
height = 13.90289,
dpi = 300)