-
Notifications
You must be signed in to change notification settings - Fork 1
/
Day2_Lines.R
98 lines (86 loc) · 4.7 KB
/
Day2_Lines.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
rm(list=ls())
library(sf)
library(ragg)
library(extrafont)
library(tidyverse)
library(paletteer)
data1 <- st_read("Data/open-rivers_4241952/oprvrs_gb.gpkg", layer="HydroNode")
data2 <- st_read("Data/open-rivers_4241952/oprvrs_gb.gpkg", layer="WatercourseLink")
mapdata <- data2 %>%
filter(!form %in% c("lake", "canal")) %>%
mutate(type=case_when(
grepl("River", watercourseName)==TRUE ~ "River",
grepl("Burn", watercourseName)==TRUE ~ "Burn",
grepl("Water", watercourseName)==TRUE ~ "Water",
grepl("Beck", watercourseName)==TRUE ~ "Beck",
grepl("Brook", watercourseName)==TRUE ~ "Brook",
grepl("Afon", watercourseName)==TRUE ~ "Afon",
grepl("Abhainn", watercourseName)==TRUE ~ "Abhainn",
grepl("Allt", watercourseName)==TRUE ~ "Allt",
grepl("Nant", watercourseName)==TRUE ~ "Nant",
grepl("Drain", watercourseName)==TRUE ~ "Drain",
grepl("Creek", watercourseName)==TRUE ~ "Creek",
grepl("Stell", watercourseName)==TRUE ~ "Stell",
grepl("Low", watercourseName)==TRUE ~ "Low",
grepl("Stream", watercourseName)==TRUE ~ "Stream",
grepl("Fleet", watercourseName)==TRUE ~ "Fleet",
TRUE ~ NA_character_
))
table(mapdata$type)
agg_png("Day2_Lines.png", units="in", width=7.5, height=8, res=800, background="cornsilk")
ggplot(mapdata %>% filter(!is.na(type)), aes(geometry=geom, colour=type, fill=type))+
geom_sf(size=0.2)+
theme_void()+
xlim(-200000, 800000)+
ylim(50000,1200000)+
scale_colour_manual(name="", values=c("#3366cc", "#dc3912", "#ff9900", "#109618", "#990099",
"#0099c6", "#dd4477", "#66aa00","Grey50", "#b82e2e"))+
scale_fill_manual(name="", values=c("#3366cc", "#dc3912", "#ff9900", "#109618", "#990099",
"#0099c6", "#dd4477", "#66aa00","Grey50", "#b82e2e"))+
theme(text=element_text(family="Lobster Two", colour="royalblue4"), plot.title.position="plot",
plot.caption.position="plot", plot.title=element_text(face="bold", size=rel(2.4)),
plot.background=element_rect(fill="cornsilk", colour="cornsilk"))+
labs(title="Rivers flow not past, but through us",
subtitle="Most common synonyms for 'river' in Great Britain",
caption="Data from OS Open Rivers | Plot by @VictimOfMaths\n\nContains Ordnance Survey data © Crown copyright and database right 2020\n")
dev.off()
#Plot of the missing rivers
ggplot(mapdata %>% filter(is.na(type)), aes(geometry=geom))+
geom_sf(size=0.1)+
theme_void()+
xlim(-200000, 900000)+
ylim(100000,1300000)
agg_png("Day2_Linesv2.png", units="in", width=9, height=8, res=800, background="cornsilk")
ggplot(mapdata %>% filter(!is.na(type) & !type %in% c("Creek", "Low", "Stell", "Stream", "Fleet")),
aes(geometry=geom, colour=type, fill=type))+
geom_sf(size=0.2)+
theme_void()+
xlim(-200000, 800000)+
ylim(50000,1200000)+
scale_colour_manual(name="", values=c("#3366cc", "#dc3912", "#ff9900", "#109618", "#990099",
"#0099c6", "#dd4477", "#66aa00","Grey50", "#b82e2e"))+
scale_fill_manual(name="", values=c("#3366cc", "#dc3912", "#ff9900", "#109618", "#990099",
"#0099c6", "#dd4477", "#66aa00","Grey50", "#b82e2e"))+
theme(text=element_text(family="Lobster Two", colour="royalblue4"), plot.title.position="plot",
plot.caption.position="plot", plot.title=element_text(face="bold", size=rel(2.4)),
plot.background=element_rect(fill="cornsilk", colour="cornsilk"))+
facet_wrap(~type)+
labs(title="Rivers flow not past, but through us",
subtitle="Most common synonyms for 'river' in Great Britain",
caption="Data from OS Open Rivers | Plot by @VictimOfMaths\n\nContains Ordnance Survey data © Crown copyright and database right 2020\n")
dev.off()
agg_png("Day2_Linesv3.png", units="in", width=9, height=8, res=800, background="cornsilk")
ggplot(mapdata %>% filter(!is.na(type) & type %in% c("Creek", "Low", "Stell", "Stream", "Fleet")),
aes(geometry=geom))+
geom_sf(size=0.5, colour="Black")+
theme_void()+
xlim(-200000, 800000)+
ylim(50000,1200000)+
theme(text=element_text(family="Lobster Two", colour="royalblue4"), plot.title.position="plot",
plot.caption.position="plot", plot.title=element_text(face="bold", size=rel(2.4)),
plot.background=element_rect(fill="cornsilk", colour="cornsilk"))+
facet_wrap(~type)+
labs(title="Rivers flow not past, but through us",
subtitle="Less common synonyms for 'river' in Great Britain",
caption="Data from OS Open Rivers | Plot by @VictimOfMaths\n\nContains Ordnance Survey data © Crown copyright and database right 2020\n")
dev.off()