-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresults.Rmd
1851 lines (1553 loc) · 69.4 KB
/
results.Rmd
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: 'Predicted shifts in the distribution of Atlantic reef building corals in face of climate change'
author:
- Silas C. Principe:
email: [email protected]
institute: [USP]
correspondence: true
- name: João Espíndola
institute: USP
- name: André L. Acosta
institute: IEA
- name: Tito M. C. Lotufo
institute: USP
institute:
- USP: Laboratório de Biologia Recifal, Instituto Oceanográfico, Universidade de São Paulo, São Paulo, Brazil.
- IEA: Instituto de Estudos Avançados, Universidade de São Paulo, São Paulo, Brazil.
bibliography:
output:
word_document:
reference_docx: article_styling/my-styles.docx
pandoc_args:
- '--lua-filter=article_styling/lua-filters/scholarly-metadata.lua'
- '--lua-filter=article_styling/lua-filters/author-info-blocks.lua'
---
```{r notes, message=FALSE, warning=FALSE, include=FALSE}
#NOTE FOR READERS:
#This section is fully reproducible. Exception is the treatment of future layers (netcdf files from CMIP5) that were first edited on CDO (Climate Data Operators), an open source software (so, it's possible to follow our pathway there easily). More information regarding this is in the section of environmental layers.
#Readers may be aware of two important points:
#1. As this is a modelling procedure, some steps may take several hours to run.
#2. Due to inherent aspects of some functions/packages, even setting a seed there may still be small differences when running the code again. However, this will not interfere in the final results.
#Because of that, for some steps files are provided ready to use. Even though, full codes are supplied and there will be a notice pointing to it, so the reader can decide to run everything again or not.
#Here we will just run the following steps:
# Pseudo-absences generation
# Block preparing for cross validation
# BIOMOD Modeling
# Get variables importances
# Get metrics
# Prepare maps
#The previous steps (environmental layers preparing, data cleaning, etc.) can be run with the codes provided
#Also, Bootstrap by default will not run, but you can just set the chunk to run if you want. But NOTE THAT THIS MAY TAKE SEVERAL HOURS TO RUN (maybe days).
# One last note: due to word/knitr limitations it may be the case that the images will appear bigger than the page
# in the final word output. Just reduce it in the output to see it full.
```
```{r Pseudo-absence generation, eval=TRUE, include=FALSE, echo=FALSE, message=FALSE, warning=FALSE}
# Set seed for replicability
set.seed(2932)
# Load the function. To see how pseudo-absences are generated, see the source
# file. The same for the others functions used here.
source("functions/pseudoabGen.R")
# Run the pseudo absence generation
lapply(c("muhi", "moca", "side"), pseudoabGen)
# Files are now saved to be used in the next step.
```
```{r Cross-validation blocks generation, eval=TRUE, include=FALSE, echo=FALSE, message=FALSE, warning=FALSE}
# Load function
source("functions/blockGen.R")
# Run the generation of blocks for cross validation
blockGen(c("muhi", "moca", "side"))
# Block files are now saved to be used in the next step.
```
```{r Modeling proccess, eval=TRUE, include=FALSE, echo=FALSE, message=FALSE, warning=FALSE}
# Load function
source("functions/biomodModelling.R")
# Run the modeling procedure
lapply(c("muhi", "moca", "side"),
biomodModelling,
round.code = "rbf1") # this is the code that is used by
# BIOMOD2 to save the files in the
# respective species' folders.
# All modelling process is done.
```
Results
=======
Models performance and variables importance
-------------------------------------------
The models performed well for all three species (Table 1). All
algorithms achieved TSS scores higher than the established threshold of
0.7 in the cross-validation procedure and were thus included in the
final ensemble. The BRT and RF algorithms achieved the highest TSS
scores, except when applied for *Siderastrea*, for which the GLMs
outperformed RFs. The GAMs consistently yielded low TSS values among the
algorithms. The AUC (area under the curve) values were higher than the
TSS values for all models, but this metric can be inflated and should be
used with caution as a model performance metric.
```{r Set the models performance table, echo=FALSE, message=FALSE, warning=FALSE}
#Load libraries
library(knitr)
#Get source function
source("functions/metricsTable.R")
#Get table and make adjustments
metrics.table <- lapply(c("muhi", "moca", "side"), metricsTable, round.code = "rbf1")
metrics.table <- bind_rows(metrics.table)
metrics.table <- cbind(data.frame("Species" = c("M. hispida", rep(NA, 3),
"M. cavernosa", rep(NA, 3),
"Siderastrea", rep(NA, 3))), metrics.table[,1:5])
#Print table
options(knitr.kable.NA = '')
kable(metrics.table,
format = "pandoc",
caption = "Table 1 Performance of species distribution models for Mussismilia hispida, Montastraea cavernosa and Siderastrea obtained through four distinct algorithms (Generalized Additive Model - GAM; Boosted Regression Trees - BRT; Generalized Linear Models - GLM; Random Forest - RF). Values are the average of five runs of block cross-validation with ± standard deviation, for each algorithm. TSS is the True Skill Statistics and was used as the main metric. AUC is the Area Under the curve metric. TSS and AUC values range from 0 to 1 and specificity and sensitivity values range from 0 to 100. Models in bold are the algorithms that had the better performance for each species.")
```
```{r Bootstrap analysis of variation, eval=FALSE, include=FALSE, echo=FALSE, message=FALSE, warning=FALSE}
#### This part of the code will not run! If you want it to run change eval=TRUE
# Load and run code
source("codes/cv_bootstrap.R")
```
Our bootstrap analysis for detecting uncertainty in the predictions of
models showed higher variations on the edges of the occurrence areas
(Supplementary Figures 1, 2, and 3). Thus, the predictions are thought
to be more reliable in the current range of the species than elsewhere.
The \"unalikeability\", based on the binary ensembles, was less than 0.3
for all models/species. In general, the models were more often in
disagreement on the edges of the presence points. As expected, the
future predictions showed consistently higher uncertainty for all
species when compared to the current period.
The most relevant variables for the models varied among species (Table
2). Salinity contributed the most to explaining the habitat suitability
of *M. hispida* geographically expressed in the ensemble model. For *M.
cavernosa* and *Siderastrea*, chlorophyll-a and temperature were the
variables with the greatest importances. Calcite, the current velocity
and the cloud cover showed minor importances for all species models.
```{r Set the variables importance table, echo=FALSE}
#Load libraries
library(knitr)
#Get source function
source("functions/varimpTable.R")
#Get table and make adjustments
var.table <- lapply(c("muhi", "moca", "side"), varimpTable, round.code = "rbf1")
var.table <- lapply(var.table, pivot_longer, cols = c(1:12), names_to = "Variable")
var.table <- cbind(var.table[[1]], var.table[[2]]$value, var.table[[3]]$value)
colnames(var.table) <- c("Variable", "M. hispida", "M. cavernosa", "Siderastrea")
var.table$Variable <- c("Calcite concentration - mean",
"Chlorophyll-a concentration - maximum",
"Cloud cover - maximum", "Nitrate concentration - mean",
"Sea water pH - mean", "Phosphate concentration - maximum",
"Salinity - mean",
"Silicate concentration - mean",
"Sea surface temperature - maximum",
"Current velocity - mean",
"Wind speed - mean",
"Depth")
#Print table
kable(var.table,
format = "pandoc",
caption = "Table 2 Importance of variables used to produce the ensemble models. Values are the mean importance obtained in a 20-fold permutation of variables. On each permutation, each variable is shuffled and a new prediction is generated. Then, a Pearson\'s correlation between the original prediction and the \'shuffled\' one is generated. Values of importance are given as 1-correlation. Highest values reveals a higher influence of the variable on the model. The most important variable for each species is in bold.")
```
Distributions of reef builders
-----------------------------
All species studied here will experience a reduction in the suitability
of their habitats in the future (2100) in at least one scenario;
however, increases in suitable areas were also projected in some
regions. As expected, *M. hispida* showed the smallest suitable area
among the three species (even considering suitable areas beyond its
current range), while *Siderastrea* had the widest range of suitable
areas. A summary of the current distributions and expected changes in
the future scenarios is provided in Table 3. To better understand how
the species are distributed in the present and in the future, we divided
the Atlantic into three distinct regions, using the Marine Ecoregions of
the World classification as a reference (Spalding et al., 2007). The
first region was named the Southwestern Atlantic region and comprises
the warm temperate southwestern Atlantic, tropical southwestern
Atlantic, North Brazil Shelf and Magellanic provinces. The North
Atlantic region includes the tropical northwestern Atlantic, the warm
temperate northwestern Atlantic and the cold temperate northwestern
Atlantic provinces. Finally, the Eastern Atlantic region comprises all
provinces in the eastern part of our study area, including the islands
not contained in the other provinces.
```{r Get values of change in the distribution of species, echo=FALSE, message=FALSE, warning=FALSE}
#Get source function
source("functions/getDiff.R")
source("functions/areaChange.R")
# Calculate the change in area for all species
area.change <- lapply(c("muhi", "moca", "side"), areaChange, round.code = "rbf1")
#Muhi data prep
muhi <- getDiff(area.change[[1]])
tableFun <- function(dif, orig){
ftable <- data.frame(matrix(nrow = 4, ncol = 5))
colnames(ftable) <- c("Region", "Current area", "RCP 2.6", "RCP 4.5", "RCP 8.5")
ftable[,1] <- c("Total", "Southwestern Atlantic", "North Atlantic", "Eastern Atlantic")
ftable[1,2] <- round(orig[2,1], digits = 1)
ftable[2,2] <- round(orig[4,1], digits = 1)
ftable[3,2] <- round(orig[6,1], digits = 1)
ftable[4,2] <- round(orig[8,1], digits = 1)
for (i in 3:5) {
cc <- i-1
ftable[1,i] <- paste0(round(ftable[1,2]+dif[1,cc], 1), " (", dif[2,cc], "%)")
ftable[2,i] <- paste0(round(ftable[2,2]+dif[3,cc], 1), " (", dif[4,cc], "%)")
ftable[3,i] <- paste0(round(ftable[3,2]+dif[5,cc], 1), " (", dif[6,cc], "%)")
ftable[4,i] <- paste0(round(ftable[4,2]+dif[7,cc], 1), " (", dif[8,cc], "%)")
}
ftable
}
muhi.f <- tableFun(muhi, area.change[[1]])
#Moca data prep
moca <- getDiff(area.change[[2]])
moca.f <- tableFun(moca, area.change[[2]])
#Side data prep
side <- getDiff(area.change[[3]])
side.f <- tableFun(side, area.change[[3]])
#Get table and make adjustments
change.table <- rbind(muhi.f, moca.f, side.f)
change.table <- cbind(data.frame("Species" = c("M. hispida", rep(NA, 3),
"M. cavernosa", rep(NA, 3),
"Siderastrea", rep(NA, 3))),
change.table)
#Print table
options(knitr.kable.NA = '')
kable(change.table,
format = "pandoc",
caption = "Table 3 Current and future projected area for three reef builders of the Atlantic obtained through species distribution models. Future projections are for three different scenarios of Relative Concentration Pathway (RCP 2.6, RCP 4.5 and RCP 8.5). Area (in Km²) is shown by regions (see results section for further information). Values in brackets are percentage of area change in future scenarios (positive, gain; negative, loss). Note that for *M. hispida*, the value in bold is the region that the species currently inhabit as it\'s endemic from Brazil, but models were projected for the whole study area (other values).")
```
In the Southwestern Atlantic, which is the current range of distribution
of *M. hispida*, suitable areas were projected from the north coast of
Santa Catarina (27°S) to Maranhão state (0.8°S), with some gaps
associated with river discharges (Figure 1). A major gap is associated
with the discharge of the São Francisco River (10°S), one of the major
rivers of Brazil. This gap was also evident in the ranges of *M.
cavernosa* and *Siderastrea* (Figures 3 and 4, respectively). To the
south, another gap is located near the areas influenced by the Doce
River discharge along the coast of Espírito Santo state (approximately
19-20°S). Additionally, there is a discontinuity in the distribution
associated with Guanabara Bay on the coast of Rio de Janeiro state
(23°S). In northern Brazil, only two patches of suitable areas were
projected, with the area farther north associated with the Parcel do
Manuel Luis reef. Beyond the current distribution of the species, the
model also identified suitable areas in the Caribbean region and on the
coast of Morocco. Although the model projected suitable areas for *M.
hispida* at depths over 100 m, the majority of suitable areas were
shallower than 40 m (median = 21.2 m; Q1 = 42.4 m; Q3 = 8.2 m), which is
in agreement with the actual biology of the species.
```{r Current map of M. hispida, fig.cap="Figure 1 Projected habitat suitability of Mussismilia hispida in the Atlantic obtained through an ensemble modeling approach. Map (A) shows the presence points (in orange) used for training the model and shows (in purple) the expected range of M. hispida according to the IUCN. Map (B) presents the predicted habitat suitability for the current period. In both maps inset maps show the Abrolhos region, where M. hispida plays a key role as a habitat-forming species. In map (B), the left inset map highlights the patches of suitable areas in northern Brazil.", fig.align="center", fig.height=5.9, fig.width=16.3, message=FALSE, warning=FALSE, echo = FALSE}
### Generate map for current projection of Mussismilia hispida ----
# Load base objects for maps ----
source("codes/graphs/plot_maps_base.R")
# Establish the round code to generate map ----
rd <- "rbf1"
#Presence points map ----
m.hisp.iucn <- st_as_sf(shapefile("gis/iucn_maps/mussismilia_hispida.shp"))
m.hisp.pts <- read.csv("data/muhi/muhi_cell.csv")
m.hisp.range <- base.tr + geom_sf(data = m.hisp.iucn, fill = alpha("#785EF0", 1), color = NA) +
coord_sf(
xlim = c(-99, 22),
ylim = c(-42.5, 42.5),
expand = FALSE,
label_axes = list(top = "E", left = "N")
) +
geom_point(data = m.hisp.pts, aes(x = decimalLongitude, y = decimalLatitude),
color = "#FFD400", size = 1, alpha = 0.8) + n.arrow +
main.scale + main.theme +
main.s.x + main.s.y
m.hisp.r.ins <- m.hisp.range +
coord_sf(
xlim = c(-49, -35),
ylim = c(-28.5, -15.5),
expand = FALSE
) + inset.theme
m.hisp.range.f <- m.hisp.range +
annotate(
"rect",
xmin = -49,
xmax = -35,
ymin = -28.5,
ymax = -15.5,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"segment",
#x1 > insh1 ; x2 > insh2
x = c(-35),
y = c(-23),
xend = c(-10),
yend = c(-23),
lineend = "round",
colour = "grey50",
size = 0.8
) +
annotation_custom(
grob = ggplotGrob(m.hisp.r.ins),
xmin = -22,
xmax = 19,
ymin = -30,
ymax = 3
) +
ggtitle("A")
#Current map ----
m.hisp <- paSuit("muhi", rd, axis.p = 'right', nar = F)
insh1 <- paSuit('muhi', rd, 'inset') +
coord_sf(
xlim = c(-40.3, -33),
ylim = c(-21.5, -16.5),
expand = FALSE
)
insh2 <- paSuit('muhi', rd, 'inset') +
coord_sf(
xlim = c(-44.6, -38),
ylim = c(-4, -0.3),
expand = FALSE
)
m.hisp.main <- m.hisp +
annotate(
"rect",
xmin = -40.3,
xmax = -33,
ymin = -21.5,
ymax = -16.5,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"rect",
xmin = -44.6,
xmax = -38,
ymin = -4,
ymax = -0.3,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"segment",
#x1 > insh1 ; x2 > insh2
x = c(-33, -44.6),
y = c(-18, -2.3),
xend = c(-28, -54),
yend = c(-18, -2.3),
lineend = "round",
colour = "grey50",
size = 0.8
) +
annotation_custom(
grob = ggplotGrob(insh1),
xmin = -28,
xmax = -10,
ymin = -27,
ymax = -10
) + annotation_custom(
grob = ggplotGrob(insh2),
xmin = -80,
xmax = -52,
ymin = 0,
ymax = -16
) +
ggtitle("B")
# Create the figure using pacthwork and save ----
muhi.fig1 <- m.hisp.range.f + m.hisp.main
muhi.fig1
ggsave("figures/fig1_muhi_current.tiff", muhi.fig1, width = 41, height = 15, dpi = 300, units = 'cm')
rm(list = ls())
```
There were increases in the projected suitable areas for *M. hispida* in
two future scenarios (RCP2.6 and RCP4.5; Figure 2). However, when
considering only areas in the Southwestern Atlantic region, decreases
are expected in all scenarios (Table 3 and Figure 2). Suitable areas for
*M. hispida* will be lost all along the northeastern coast of Brazil and
along its southern limit, regardless of the scenario. Additionally, the
two patches on the coast of the Maranhão (0.8°S) and Ceará (3.6°S)
states will be lost. Major losses of suitable areas will also occur in
the Vitória-Trindade seamount chain and in the Abrolhos region; these
losses would be critical in the RCP4.5 and RCP8.5 scenarios, with all
suitable areas being lost.
New suitable areas are predicted in the southern and northern boundaries
of the present distribution of *M. hispida* for all scenarios. In the
RCP4.5 and RCP8.5 scenarios, the gain of new areas is diminished, but
suitable areas are expected to occur far south of the current
distribution region along the coast of Argentina (40°S to 42°S).
Interestingly, some areas that would become suitable in RCP2.6 scenario
are in regions of river discharge. New suitable areas would also occur
in the denominated North Atlantic region. These projections do not
consider the Amazon river mouth barrier, which currently limits the
distribution of this species to the Brazilian coast. There was no
evident change trend in the suitable area depth (RCP2.6: median = 20.1
m, RCP4.5: median = 16.8 m, RCP8.5: median = 17.3 m; Supplementary Table
2).
```{r Future map of M. hispida, fig.cap="Figure 2 Projected habitat suitabilities for future relative concentration pathway (RCP) scenarios for Mussismilia hispida in the Atlantic Ocean, obtained through an ensemble modeling approach. The models were trained on present-day data of each species and projected for the (A) RCP2.6, (B) RCP4.5 and (C) RCP8.5 scenarios. Inset maps highlight changes in northern Brazil (top) and in the Abrolhos region (bottom).", fig.align="center", fig.height=16.3, fig.width=8.9, message=FALSE, warning=FALSE, echo = FALSE}
### Generate map for future scenarios of Mussismilia hispida ----
# Load base objects for maps ----
source("codes/graphs/plot_maps_base.R")
# Establish the round code to generate map ----
rd <- "rbf1"
# Create a list to hold plots
plots.list <- list()
# Execute all the scenarios in loop ----
for (i in 1:3) {
rcp.code <- c("rcp26", "rcp45", "rcp85")[i]
if (i == 1) {
axis.sel <- "left-top"
nar.sel = TRUE
}
if (i == 2) {
axis.sel <- "left-only"
nar.sel = FALSE
}
if (i == 3) {
axis.sel <- "left"
nar.sel = FALSE
}
if (i == 1) {
rcp.plot <-
rcpSuit("muhi", rd, rcp.code, 100, axis.p = axis.sel, nar = nar.sel)
}
if (i != 1) {
rcp.plot <-
rcpSuit("muhi", rd, rcp.code, 100, axis.p = axis.sel, nar = nar.sel) +
theme(legend.position = 'none')
}
ins1 <-
rcpSuit("muhi",
rd,
rcp.code,
100,
axis.p = 'none',
theme = 'inset') +
coord_sf(
xlim = c(-42, -31),
ylim = c(-10.5, -1),
expand = FALSE
)
ins2 <-
rcpSuit("muhi",
rd,
rcp.code,
100,
axis.p = 'none',
theme = 'inset') +
coord_sf(
xlim = c(-40.3, -33),
ylim = c(-21.5, -16.5),
expand = FALSE
)
final.plot <- rcp.plot +
annotate(
"rect",
xmin = -42,
xmax = -31,
ymin = -10.5,
ymax = -1,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"rect",
xmin = -40.3,
xmax = -33,
ymin = -21.5,
ymax = -16.5,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"segment",
x = c(-65, -33),
y = c(-5, -18),
xend = c(-42, -20),
yend = c(-5, -18),
lineend = "round",
colour = "grey50",
size = 0.8
) +
annotation_custom(
grob = ggplotGrob(ins1),
xmin = -85,
xmax = -55,
ymin = 5,
ymax = -21
) +
annotation_custom(
grob = ggplotGrob(ins2),
xmin = -26,
xmax = -2,
ymin = -27,
ymax = -9
)+ # The lines below are a "hack" to adjust the tag
# annotation position
theme(
plot.margin = unit(c(0.5, 5, 0.5, 5), 'mm'),
axis.title.y = element_text(
margin = margin(t = 0, r = 20, b = 0, l = 0))
)+ylab(" ")
plots.list[[i]] <- final.plot
}
# Create the figure using pacthwork and save ----
muhi.fig2 <- plots.list[[1]] / plots.list[[2]] / plots.list[[3]] +
plot_annotation(tag_levels = "A") &
theme(plot.tag.position = c(0, 0.95),
plot.tag = element_text(size = 18))
muhi.fig2
ggsave("figures/fig2_muhi_future.tiff", muhi.fig2,
width = 22.5, height = 41, dpi = 300, units = 'cm')
rm(list = ls())
```
*Montastraea cavernosa* and *Siderastrea* exhibited similar habitat
suitability patterns in the current period, in agreement with their
current distribution ranges (Figures 3 and 4, respectively). The
majority of suitable areas for both species were distributed in the
northeastern and north coast of Brazil, up to the coast of Maranhão
state and in the North Atlantic. Suitable areas were also observed at
similar depths, although the maximum depth of *M. cavernosa* was deeper
than that of *Siderastrea* (*M. cavernosa* - median = 40.5 m, maximum =
194.6 m; *Siderastrea* - median = 37.6 m, maximum = 185.8 m). Despite
these similarities, some differences in habitat suitability are evident.
The predicted southern limit of the suitable areas for *M. cavernosa*
was 22.4°S, but the *Siderastrea* distribution extended farther south,
reaching Rio de Janeiro state (23°S). Additionally, adequate areas for
*Siderastrea* were predicted on the Ascension, Cape Verde and São Tomé
islands, but suitable areas for *M. cavernosa* were found only on São
Tomé and Ascension (although the species is not currently found in the
latter area). Another evident difference is the larger extent of
suitable areas for *Siderastrea* in the Gulf of México and on the
western side of Florida than that for *M. cavernosa*. However, *M.
cavernosa* was the only species with suitable areas on Bermudas Island
in the western Atlantic, thus having a higher northern limit than that
of *Siderastrea* (approximately 32°N versus approximately 28°N for
*Siderastrea*). Several areas that were considered to be within the
ranges of both species according to the IUCN were not supported by our
models as suitable areas.
```{r Current map of M. cavernosa, fig.cap="Figure 3 Projected habitat suitability for Montastraea cavernosa in the Atlantic Ocean obtained through an ensemble modeling approach. Map (A) shows the presence points (in orange) used for training the model and shows (in purple) the expected range of M. cavernosa according to the IUCN. Map (B) shows the predicted habitat suitability for the current period. In both maps, inset maps highlight the Abrolhos region (left) and São Tomé islands (right), and in map (B), the top inset highlights the Caribbean islands.", fig.align="center", fig.height=5.9, fig.width=16.3, message=FALSE, warning=FALSE, echo = FALSE}
### Generate map for current projection of Montastraea cavernosa ----
# Load base objects for maps ----
source("codes/graphs/plot_maps_base.R")
# Establish the round code to generate map ----
rd <- "rbf1"
#Presence points map ----
moca.iucn <- st_as_sf(shapefile("gis/iucn_maps/montastraea_cavernosa.shp"))
moca.pts <- read.csv("data/moca/moca_cell_thinned.csv")
moca.range <- base.tr + geom_sf(data = moca.iucn, fill = alpha("#785EF0", 1), color = NA) +
coord_sf(
xlim = c(-99, 22),
ylim = c(-42.5, 42.5),
expand = FALSE,
label_axes = list(top = "E", left = "N")
) +
geom_point(data = moca.pts, aes(x = decimalLongitude, y = decimalLatitude),
color = "#FFD400", size = 1, alpha = 0.8) + n.arrow +
main.scale + main.theme +
main.s.x + main.s.y
ins1 <- moca.range +
coord_sf(
xlim = c(-49, -35),
ylim = c(-28.5, -15.5),
expand = FALSE
) + inset.theme
ins2 <- moca.range +
coord_sf(
xlim = c(3, 8),
ylim = c(-3, 3),
expand = FALSE
) + inset.theme
range.f <- moca.range +
annotate(
"rect",
xmin = -49,
xmax = -35,
ymin = -28.5,
ymax = -15.5,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"rect",
xmin = 8,
xmax = 3,
ymin = -3,
ymax = 3,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"segment",
#x1 > insh1 ; x2 > insh2
x = c(-49, 6.5),
y = c(-23, 3),
xend = c(-80, 6.5),
yend = c(-23, 15),
lineend = "round",
colour = "grey50",
size = 0.8
) +
annotation_custom(
grob = ggplotGrob(ins1),
xmin = -92,
xmax = -56,
ymin = -30,
ymax = 2
) +
annotation_custom(
grob = ggplotGrob(ins2),
xmin = 0,
xmax = 18,
ymin = 10,
ymax = 30
)+
ggtitle("A")
#Current map ----
m.cav <- paSuit("moca", rd, axis.p = 'right', nar = F)
insc1 <- paSuit('moca', rd, 'inset') +
coord_sf(
xlim = c(-67.5, -59),
ylim = c(11, 19),
expand = FALSE
)
insc2 <- paSuit('moca', rd, 'inset') +
coord_sf(
xlim = c(-40, -33),
ylim = c(-22, -16),
expand = FALSE
)
insc3 <- paSuit('moca', rd, 'inset') +
coord_sf(
xlim = c(3, 9),
ylim = c(-3, 3),
expand = FALSE
)
m.cav.main <- m.cav +
annotate(
"rect",
xmin = -59,
xmax = -67.5,
ymin = 11,
ymax = 19,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"rect",
xmin = -33,
xmax = -40,
ymin = -16,
ymax = -22,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"rect",
xmin = 9,
xmax = 3,
ymin = -3,
ymax = 3,
color = "grey50",
alpha = 0,
size = 0.8
)+
annotate(
"segment",
x = c(-59,-60, 6.5),
y = c(16, -18, 3),
xend = c(-55,-40, 6.5),
yend = c(16, -18, 15),
lineend = "round",
colour = "grey50",
size = 0.8
) +
annotation_custom(
grob = ggplotGrob(insc1),
xmin = -55,
xmax = -35,
ymin = 15,
ymax = 35
) + annotation_custom(
grob = ggplotGrob(insc2),
xmin = -55,
xmax = -80,
ymin = 5,
ymax = -25
) +
annotation_custom(
grob = ggplotGrob(insc3),
xmin = 0,
xmax = 18,
ymin = 10,
ymax = 30
)+
ggtitle("B")
# Create the figure using pacthwork and save ----
mcav.fig1 <- range.f + m.cav.main
mcav.fig1
ggsave("figures/fig3_moca_current.tiff", mcav.fig1, width = 41, height = 15, dpi = 300, units = 'cm')
rm(list = ls())
###END
```
```{r Current map of Siderastrea, fig.cap="Figure 4 Projected habitat suitability for Siderastrea in the Atlantic, as obtained through an ensemble modeling approach. Map (A) shows the presence points (in orange) used for training the model and shows (in purple) the expected range of Siderastrea according to the IUCN. Map (B) shows the predicted habitat suitability for the current period. In both maps, inset maps highlight the Abrolhos region (left), Cape Verde (top) and São Tomé islands (right).", fig.align="center", fig.height=5.9, fig.width=16.3, message=FALSE, warning=FALSE, echo = FALSE}
### Generate map for current projection of Siderastrea ----
# Load base objects for maps ----
source("codes/graphs/plot_maps_base.R")
# Establish the round code to generate map ----
rd <- "rbf1"
#Presence points map ----
side1.iucn <- st_as_sf(shapefile("gis/iucn_maps/siderastrea_stellata.shp"))
side2.iucn <- st_as_sf(shapefile("gis/iucn_maps/siderastrea_radians.shp"))
side.pts <- read.csv("data/side/side_cell_thinned.csv")
side.range <- base.tr + geom_sf(data = side1.iucn, fill = alpha("#785EF0", 1), color = NA) +
geom_sf(data = side2.iucn, fill = alpha("#785EF0", 1), color = NA) +
coord_sf(
xlim = c(-99, 22),
ylim = c(-42.5, 42.5),
expand = FALSE,
label_axes = list(top = "E", left = "N")
) +
geom_point(data = side.pts, aes(x = decimalLongitude, y = decimalLatitude),
color = "#FFD400", size = 1, alpha = 0.8) + n.arrow +
main.scale + main.theme +
main.s.x + main.s.y
ins1 <- side.range +
coord_sf(
xlim = c(-49, -35),
ylim = c(-28.5, -15.5),
expand = FALSE
) + inset.theme
ins2 <- side.range +
coord_sf(
xlim = c(3, 8),
ylim = c(-3, 3),
expand = FALSE
) + inset.theme
ins3 <- side.range +
coord_sf(
xlim = c(-27, -21),
ylim = c(14, 20),
expand = FALSE
) + inset.theme
range.f <- side.range +
annotate(
"rect",
xmin = -49,
xmax = -35,
ymin = -28.5,
ymax = -15.5,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"rect",
xmin = 8,
xmax = 3,
ymin = -3,
ymax = 3,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"rect",
xmin = -27,
xmax = -21,
ymin = 14,
ymax = 20,
color = "grey50",
alpha = 0,
size = 0.8
) +
annotate(
"segment",
#x1 > insh1 ; x2 > insh2
x = c(-49, 6.5, -24),
y = c(-23, 3, 20),
xend = c(-80, 6.5, -24),
yend = c(-23, 15, 30),
lineend = "round",
colour = "grey50",
size = 0.8
) +
annotation_custom(
grob = ggplotGrob(ins1),
xmin = -92,
xmax = -56,
ymin = -30,
ymax = 2
) +
annotation_custom(
grob = ggplotGrob(ins2),
xmin = 0,
xmax = 18,
ymin = 10,
ymax = 30
)+
annotation_custom(
grob = ggplotGrob(ins3),
xmin = -17,
xmax = -37,
ymin = 24,
ymax = 41
)+
ggtitle("A")
#Current map ----
side <- paSuit("side", rd, axis.p = 'right', nar = F)
inss1 <- paSuit('side', rd, 'inset') +
coord_sf(
xlim = c(-67.5, -59),
ylim = c(11, 19),
expand = FALSE
)
inss2 <- paSuit('side', rd, 'inset') +
coord_sf(
xlim = c(-40, -33),
ylim = c(-22, -16),
expand = FALSE
)
inss3 <- paSuit('side', rd, 'inset') +
coord_sf(
xlim = c(3, 9),
ylim = c(-3, 3),
expand = FALSE
)
inss4 <- paSuit('side', rd, 'inset') +
coord_sf(
xlim = c(-27, -21),
ylim = c(14, 20),
expand = FALSE
)
side.main <- side +
annotate(
"rect",
xmin = -67.5,