-
Notifications
You must be signed in to change notification settings - Fork 0
/
IHO_world_maps.R
61 lines (50 loc) · 1.87 KB
/
IHO_world_maps.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
# make global maps with iho sea regions
# load libraries
library(sf)
library(mregions)
library(ggplot2)
library(tidyr)
library(cowplot)
## load iho sea areas
iho_mr <- mr_shp(key = 'MarineRegions:iho')
# load table
iho_table <- read.csv('WOA2-invert_marine_benthic_per_IHO.csv')
# add attributes to sf dataframe
iho <- merge(x = iho_mr,
y = iho_table,
by.x = 'name',
by.y = 'IHO.area',
all.x = TRUE)
# No 'Lincoln Sea'? -> only one record found (Ursus maritimus)
#### PLOTTING NUMBER OF SPECIES per IHO ####
#max(c(iho$spec_s200m, iho$spec_200.1000m, iho$spec_l1000m), na.rm = TRUE)
#[1] 11353
for (i in 1:3){
columns <- c('spec_s200m','spec_200.1000m', 'spec_l1000m')
titles <- c('< 200 m', '200 - 1000 m', '> 1000 m')
p <- ggplot(iho) +
geom_sf(aes(fill = get(columns[i])), size = 0.01) +
coord_sf(crs='ESRI:54030') +
scale_fill_viridis_c('# species', option = "plasma", limits = c(0,12000)) +
ggtitle(titles[i]) +
theme(panel.grid.major = element_line(colour = 'transparent'))
save_plot(paste0('species_depth_', columns[i],'.pdf'),
p,
base_aspect_ratio = 2)
}
#### PLOTTING NUMBER OF RECORDS per IHO ###
# max(c(iho$rec_s200m, iho$rec_200.1000m, iho$rec_l1000m), na.rm = TRUE)
#[1] 991541
for (i in 1:3){
columns <- c('rec_s200m','rec_200.1000m', 'rec_l1000m')
titles <- c('< 200 m', '200 - 1000 m', '> 1000 m')
p <- ggplot(iho) +
geom_sf(aes(fill = get(columns[i])), size = 0.01) +
coord_sf(crs='ESRI:54030') +
scale_fill_viridis_c('# records', option = "viridis", limits = c(0,1E6)) +
ggtitle(titles[i]) +
theme(panel.grid.major = element_line(colour = 'transparent'))
save_plot(paste0('records_depth_', columns[i],'.pdf'),
p,
base_aspect_ratio = 2)
}