-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPaleomat_Figures.Rmd
1571 lines (1410 loc) · 44.5 KB
/
Paleomat_Figures.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: "paleoMAT Figures and Tables for 'A Low-Frequency Summer Temperature Reconstruction for the United States Southwest, 3000 BC – AD 2000'"
author: "Andrew Gillreath-Brown"
date: "`r format(Sys.time(), '%d %B %Y')`"
html_document:
toc: yes
toc_depth: 2
toc_float: yes
number_sections: no
code_folding: hide
output:
html_document:
df_print: paged
mainfont: Calibri
editor_options:
chunk_output_type: console
keep_md: yes
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(paleomat)
require(ggh4x)
library(ggplot2)
library(broom)
library(cowplot)
library(gridExtra)
```
# Figures
```{r fig1, fig.cap="Figure 1. Modern pollen samples used in this study from the Neotoma Paleoecology Database.", echo = FALSE, warning = FALSE, message = FALSE, error = FALSE, results = 'hide',fig.keep = 'all', fig.height = 7.73, fig.align = "left"}
MPCT_climate_final <-
readr::read_rds(here::here("vignettes/data/pollen_cleaned/MPCT_climate_final.rds"))
usa <-
sf::st_as_sf(maps::map("state", fill = TRUE, plot = FALSE)) %>%
sf::st_transform(., crs = 4326)
ggplot2::ggplot() +
geom_sf(data = usa, fill = NA) +
geom_sf(data = MPCT_climate_final,
inherit.aes = FALSE,
aes(geometry = geometry)) +
coord_sf(xlim = c(-125, -95), ylim = c(25, 50)) +
theme_classic() +
scale_x_continuous(breaks = seq(-125, -95, 5.0)) +
scale_y_continuous(breaks = seq(25, 50, 5)) +
labs(colour = "") +
theme(
axis.ticks = element_blank(),
panel.border = element_blank(),
panel.grid.major = element_blank(),
axis.text = element_text(
size = 26,
colour = "black",
family = "Helvetica"
),
axis.text.x = element_text(angle = 90,
margin = margin(
t = -25,
r = 10,
b = 10,
l = 10
)),
axis.line = element_blank()
)
#ggplot2::ggsave("vignettes/figures/Figure1.png", dpi = 600, width = 16.31, height = 9.83, units = "in")
```
```{r fig2, fig.cap="Figure 2. The Southwest United States (SWUS) as defined here, showing locations of fossil pollen samples used in this study. Background shading indicates mean July temperature for 1961–1990 from PRISM (Daly et al. 2008; PRISM Climate Group 2019; Daly, Smith, and Olson 2015) at 800-m resolution. The solid gray box outlines the area studied by Bocinsky and Kohler (2014); the green dashed box shows the extent of the reconstruction in this study.", echo = FALSE, warning = FALSE, message = FALSE, error = FALSE, results = 'hide', fig.keep = 'all', fig.height = 9.83, fig.width = 16.31}
# Showing extent of UUSS and the fossil pollen sites.
# Get locations of the fossil pollen sites.
fossil.locs <-
paleomat::fossil_west_post5500 %>%
tidyr::extract(geometry, c('long', 'lat'), '\\((.*), (.*)\\)', convert = TRUE) %>%
dplyr::group_by(site.name) %>%
dplyr::slice(1) %>%
dplyr::ungroup() %>%
dplyr::select(site.id, site.name, long, lat)
# Get the PRISM modern July temperature dataset.
#temp.raster <- paleomat::temp.raster
temp.raster <- raster::raster(here::here(
"vignettes/data/temp.raster.tif"
))
# Create a bounding box for the upper united states southwest
bb <-
c(
"xmin" = -113,
"xmax" = -105,
"ymin" = 32,
"ymax" = 38.09
) %>%
sf::st_bbox() %>%
sf::st_as_sfc() %>%
sf::st_as_sf(crs = 4326) %>%
sf::st_transform(crs = 4326)
cities2 <- maps::us.cities %>%
dplyr::select(name, long, lat) %>%
dplyr::filter(
name %in% c(
"Farmington NM",
"Santa Fe NM",
"Albuquerque NM",
"Flagstaff AZ",
"Phoenix AZ"
)
) %>%
dplyr::add_row(name = "Mesa Verde CO",
long = -108.463050,
lat = 37.230299)
cities3 <- cities2
cities3$name <-
trimws(gsub(
pattern = "NM|AZ|CO",
replacement = "",
cities3$name,
perl = TRUE
))
cities <- cities2 %>%
sf::st_as_sf(coords = c("long", "lat"), crs = 4326)
fossil.sites <- fossil.locs %>%
sf::st_as_sf(coords = c("long", "lat"), crs = 4326)
raster::crs(temp.raster) <-
"+proj=lcc +lat_1=49 +lat_2=77 +lat_0=0 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=WGS84 +units=m +no_defs"
temperature <- raster::as.data.frame(temp.raster, xy = TRUE)
names(temperature) <- c("long", "lat", "tavg")
temperature_transformed <-
usmap::usmap_transform(
temperature,
input_names = c("long", "lat"),
output_names = c("x", "y")
)
# Create a bounding box for limits of this study
bb2 <-
c(
"xmin" = -112.81446,
"xmax" = -105.52416,
"ymin" = 32.65757,
"ymax" = 38.089
) %>%
sf::st_bbox() %>%
sf::st_as_sfc() %>%
sf::st_as_sf(crs = 4326) %>%
sf::st_transform(crs = 4326)
ggplot2::ggplot() +
geom_raster(
data = temperature_transformed,
aes(x = long, y = lat, fill = tavg),
alpha = 0.8,
na.rm = TRUE
) +
scale_fill_gradientn(colors = colorRampPalette(rev(RColorBrewer::brewer.pal(11, "RdBu")))(255),
#limits = c(-8, 8),
na.value = "transparent",
name = "Temperature °C") +
coord_equal() +
theme_classic() +
scale_x_continuous(breaks = seq(-115, -103, 2.0),
limits = c(-115, -103.2)) +
scale_y_continuous(breaks = seq(31, 39, 2.0),
limits = c(31.25, 39)) +
geom_sf(
data = usa,
color = "#2b2b2b",
fill = "transparent",
linewidth = 1.0
) +
geom_sf(
data = cities,
shape = 23,
fill = "blue",
size = 3.5
) +
geom_sf(
data = bb,
linewidth = 1.5,
fill = NA,
aes(colour = "darkgrey",
linetype = "darkgrey"),
show.legend = "line",
inherit.aes = FALSE
) +
geom_sf(
data = bb2,
linewidth = 1.5,
fill = NA,
aes(colour = "darkolivegreen4",
linetype = "darkolivegreen4"),
show.legend = "line",
inherit.aes = FALSE
) +
geom_sf(
data = fossil.sites,
shape = 20,
fill = "blue",
size = 3.5
) +
scale_color_manual(
values = c("darkgrey" = "darkgrey", "darkolivegreen4" = "darkolivegreen4"),
labels = c("Bocinsky and Kohler 2014", "This Study"),
name = "Data Extent"
) +
scale_linetype_manual(
values = c("darkgrey" = "solid", "darkolivegreen4" = "dashed"),
labels = c("Bocinsky and Kohler 2014", "This Study"),
name = "Data Extent"
) +
shadowtext::geom_shadowtext(
data = cities3,
aes(x = long, y = lat, label = name),
nudge_y = 0.265,
color = "white",
size = 4
) +
labs(colour = "") +
annotate(
"text",
x = -109.75,
y = 38.5,
label = "UTAH",
size = 6,
fontface = 2,
hjust = 1.0
) +
annotate(
"text",
x = -108.25,
y = 38.5,
label = "COLORADO",
size = 6,
fontface = 2,
hjust = 0
) +
annotate(
"text",
x = -109.75,
y = 32.3,
label = "ARIZONA",
size = 6,
fontface = 2,
hjust = 1
) +
annotate(
"text",
x = -108.25,
y = 32.3,
label = "NEW MEXICO",
size = 6,
fontface = 2,
hjust = 0
) +
theme(
legend.key.width = unit(1.25, 'cm'),
panel.border = element_blank(),
panel.grid.major = element_blank(),
axis.text = element_text(
size = 26,
colour = "black",
family = "Helvetica"
),
axis.text.x = element_text(angle = 90),
axis.title = element_blank(),
axis.line = element_blank(),
axis.ticks = element_blank(),
legend.text = element_text(size = 18, family = "Helvetica", margin = margin(b = 15, unit = "pt")),
legend.title = element_text(size = 19, family = "Helvetica")
)
#ggplot2::ggsave("vignettes/figures/Figure2.png", dpi = 600, width = 16.31, height = 9.83, units = "in")
```
```{r fig3, fig.cap= "Figure 3. Temperature for the North Atlantic using Richard Alley’s (2000) Greenland ice core data (black line) and global mean surface temperature change (Osman et al. 2021) (using the 50th ensemble percentile) for 22,000 BC to present with the Younger Dryas and the general period of the northward expansion of maize agriculture from Mesoamerica into the SWUS highlighted.", fig.height = 9.83, fig.width = 16.31, echo = FALSE, warning = FALSE, message = FALSE, error = FALSE, results = 'hide', fig.keep = 'all'}
# Greenland ice core data (used in Huckleberry 2015) from Alley 2000.
alley2000 <-
paleomat::alley_2000 %>%
dplyr::mutate(Age = Age * 1000) %>%
dplyr::mutate(Age = paleomat::BPtoBCAD(Age)) %>%
dplyr::filter(Age >= -22000)
# Globally resolved surface temperatures data from Osman et al. 2021.
osman_2021 <-
paleomat::osman_2021 %>%
dplyr::mutate(Age = paleomat::BPtoBCAD(Age)) %>%
dplyr::filter(Age >= -22000)
temps <- alley2000 %>%
dplyr::mutate(dataset = "alley2000") %>%
dplyr::bind_rows(., osman_2021 %>%
dplyr::mutate(dataset = "osman_2021") %>%
dplyr::rename(Temp2 = Temperature))
ylim.prim <- c(-50.13, -28.702)
ylim.sec <- c(-7.370059, 1)
b <- diff(ylim.prim)/diff(ylim.sec)
a <- ylim.prim[1] - b*ylim.sec[1]
ggplot(temps, aes(Age, Temperature, group = dataset)) +
geom_line(aes(y = a + Temp2*b), color = "#009E73") +
geom_line(aes(y=Temperature, group = dataset), col="black") +
scale_y_continuous("Temperature °C", sec.axis = sec_axis(~ (. - a)/b, name = "∆GMST (°C)")) +
scale_x_continuous(
breaks = seq(-22000, 2000, 2000),
limits = c(-22000, 2000),
minor_breaks = seq(-19000, 2000, by = 1000),
guide = "axis_minor"
) +
theme_classic() +
xlab("Years BC/AD") +
annotate(
"rect",
xmin = -10851 ,
xmax = -9551,
ymin = min(alley2000$Temperature) - 0.5,
ymax = max(alley2000$Temperature),
alpha = .2
) +
annotate(
"text",
x = -10201,
y = -27.25,
label = "Younger \n Dryas",
size = 8
) +
geom_segment(aes(
x = -6251,
y = -36.5,
xend = -6251,
yend = -33
),
arrow = arrow(length = unit(0.3, "cm"))) +
annotate(
"text",
x = -6251,
y = -38,
label = "6250 BC \n Cold Event",
size = 8
) +
annotate(
"rect",
xmin = -2051,
xmax = -4051,
ymin = min(alley2000$Temperature) - 0.5,
ymax = max(alley2000$Temperature),
alpha = .2
) +
annotate(
"text",
x = -3051,
y = -27.25,
label = "Northward Expansion \n of Agriculture",
size = 8
) +
theme(
axis.ticks.length = unit(0.125, "inch"),
ggh4x.axis.ticks.length.minor = rel(0.5),
panel.border = element_blank(),
panel.grid.major = element_blank(),
axis.text = element_text(
size = 26,
colour = "black",
family = "Helvetica"
),
axis.title.y = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 10,
r = 5,
b = 10,
l = 10
)
),
axis.title.x = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 5,
r = 10,
b = 10,
l = 10
)
)
)
# ggplot2::ggsave("vignettes/figures/Figure3.png", dpi = 600, width = 18.31, height = 9.83, units = "in")
```
```{r fig4, fig.cap="Figure 4. Low-frequency component of the Moberg et al. (2005) multi-proxy reconstruction for Northern Hemisphere for AD 133–1925. PAGES2k reconstructed NH temperatures using different proxies that primarily shows high frequency resolution (PAGES 2k Consortium et al. 2019). Anomalies for both series are calculated in comparison to the 1961–1990 average.", fig.height = 9.83, fig.width = 16.31, echo = FALSE, warning = FALSE, message = FALSE, error = FALSE, results = 'hide', fig.keep = 'all'}
# Moberg et al. 2005 low-frequency reconstruction (only).
Moberg <-
paleomat::moberg_2005 %>%
dplyr::mutate(dataset = "Moberg et al. 2005")
pages2k <-
paleomat::pages2k_2019 %>%
dplyr::select(date, LF = X31.year.filtered.full.ensemble.median) %>%
dplyr::mutate(dataset = "PAGES2k 2019")
moberg_pages <- dplyr::bind_rows(Moberg, pages2k)
ggplot2::ggplot(data = moberg_pages, aes(x = date, y = LF, color = dataset)) +
geom_line(linewidth = 1) +
xlab("Years AD") +
ylab("Temperature Anomaly (°C)") +
scale_color_manual(values = c("#A60F2D", "#E69F00")) +
scale_x_continuous(
breaks = seq(0, 2000, 200),
minor_breaks = seq(100, 1900, by = 200),
guide = "axis_minor"
) +
scale_y_continuous(
breaks = seq(-0.7, 0, 0.1),
limits = c(-0.7, 0),
minor_breaks = seq(-0.65,-0.05, by = 0.05),
guide = "axis_minor"
) +
theme_bw() +
geom_hline(
yintercept = 0,
color = "darkgrey",
lty = 2,
lwd = 1.25
) +
theme(
axis.ticks.length = unit(0.125, "inch"),
ggh4x.axis.ticks.length.minor = rel(0.5),
panel.border = element_blank(),
panel.grid.major = element_blank(),
axis.text = element_text(
size = 26,
colour = "black",
family = "Helvetica"
),
axis.title.y = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 10,
r = 5,
b = 10,
l = 10
)
),
axis.title.x = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 5,
r = 10,
b = 10,
l = 10
)
),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"),
plot.margin = margin(
t = 5,
r = 25,
b = 5,
l = 5
),
legend.text = element_text(size = 19, family = "Helvetica", margin = margin(b = 15, unit = "pt")),
legend.title = element_blank()
)
# ggplot2::ggsave("vignettes/figures/Figure4.png", dpi = 600, width = 16.31, height = 9.83, units = "in")
```
```{r fig5, fig.cap="Figure 5. Low-frequency bootstrapped summer temperature anomaly loess reconstruction from this study (blue) with standard error (gray) (top figure). Boxplots show estimates binned by century for all proxy samples (i.e., includes samples for the 100 simulations of the age-depth models). Anomalies are calculated in comparison to the 1961–1990 average. The temperature predictions using the median date from the age-depth model (i.e., does not include the 100 simulations) for each sample (not binned by century) are shown by circles; sizes of circles are inversely proportional to the sample-specific errors (size of circle ∝ 1/s1; see Simpson, 2007: 21 for calculation of s1). Anomaly estimates with larger circles are more precise. Histogram of proxy samples that includes the 100 simulations of the age-depth models through time in 100 year bins.", fig.height = 9.83, fig.width = 16.31, echo = FALSE, warning = FALSE, message = FALSE, error = FALSE, results = 'hide', fig.keep = 'all'}
Threebest <-
readr::read_rds(
here::here(
"vignettes/data/diagnostics_reconstruction/final_paleomat_output.rds"
)
) %>%
dplyr::filter(date >= -3000)
Threebest$century <- round(as.numeric(Threebest$date),-2)
weight <- (1 / Threebest$s1)
# Histogram of samples.
p1 <- ggplot(Threebest, aes(date)) +
geom_histogram(
color = "#000000",
fill = "cornflowerblue",
binwidth = 100,
alpha = 0.25
) +
theme_bw() +
xlab("Years BC/AD") +
ylab("Proxy Samples Per Bin") +
scale_x_continuous(
limits = c(-3050, 2100),
breaks = seq(-3000, 2000, 500),
minor_breaks = seq(-2900, 2000, by = 100),
guide = "axis_minor"
) +
theme(
panel.border = element_blank(),
panel.grid.major = element_blank(),
axis.text = element_text(
size = 26,
colour = "black",
family = "Helvetica"
),
axis.title.y = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 10,
r = 5,
b = 10,
l = 10
)
),
axis.title.x = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 5,
r = 10,
b = 10,
l = 10
)
),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"),
plot.margin = margin(
t = 5,
r = 25,
b = 5,
l = 5
)
)
# Create loess model that does the same thing as ggplot2 geom_smooth.
Threebest <- Threebest %>%
dplyr::filter(Simulation %in% 1:50)
model <- loess(anom_bootstrap ~ date, data = Threebest, span = 0.15)
preds <- predict(model, se = TRUE)
T <- qt(p = 0.99, df = preds$df)*4
lwr <- (preds$fit - T * preds$se.fit)
upr <- (preds$fit + T * preds$se.fit)
# Add predicted values from model to original dataset using broom library
Threebest2 <- broom::augment(model, Threebest) %>%
dplyr::mutate(min_error = lwr,
max_error = upr)
# Calculate weights for the circles in the plot.
weight <- Threebest %>%
dplyr::filter(Simulation == 1)
weight <- (1 / weight$s1)
p2 <- Threebest %>%
ggplot2::ggplot(aes(y = anom_bootstrap)) +
geom_boxplot(
aes(x = century, y = anom_bootstrap, group = century),
lwd = .25,
outlier.alpha = NA,
outlier.shape = NA,
position = position_dodge2(preserve = "total")
) +
geom_point(
data = Threebest %>% dplyr::filter(Simulation == 1),
aes(x = date, y = anom_bootstrap),
size = weight,
shape = 1,
inherit.aes = FALSE
) +
geom_hline(
yintercept = 0,
linetype = 'dashed',
color = c('darkslategray')
) +
geom_smooth(
method = "loess",
span = 0.15,
aes(x = date),
linewidth = 2,
colour = "cornflowerblue",
se = FALSE
) +
geom_ribbon(
data = Threebest2,
aes(x = date, ymin = min_error, ymax = max_error),
alpha = .3,
inherit.aes = FALSE
) +
scale_x_continuous(
limits = c(-3050, 2100),
breaks = seq(-3000, 2000, 500),
minor_breaks = seq(-2900, 2000, by = 100),
guide = "axis_minor"
) +
coord_cartesian(ylim = c(-10, 10)) +
scale_y_continuous(breaks = seq(-8, 8, 2)) +
theme_bw() +
xlab("Years BC/AD") +
ylab("Temperature Anomaly (°C)") +
theme(
panel.border = element_blank(),
panel.grid.major = element_blank(),
axis.text = element_text(
size = 26,
colour = "black",
family = "Helvetica"
),
axis.title.y = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 10,
r = 5,
b = 10,
l = 10
)
),
axis.title.x = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 5,
r = 10,
b = 10,
l = 10
)
),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"),
plot.margin = margin(
t = 5,
r = 25,
b = 5,
l = 5
)
)
cowplot::plot_grid(p2, p1, ncol = 1, align = "v")
g <- gridExtra::arrangeGrob(p1,
p2,
nrow = 3,
ncol = 1,
layout_matrix = cbind(c(2, 2, 1)))
#ggplot2::ggsave("vignettes/figures/Figure5.png", g, dpi = 600, width = 16.31, height = 19.66, units = "in")
```
```{r fig6, fig.cap="Figure 6. Low-frequency July temperature anomaly for the SWUS from this study, the North American July temperature reconstruction (André E. Viau et al. 2006) from 3000 BC to AD 2000, the terrestrial composite for 30–60 °N (Kaufman et al. 2020) from 3300 BC to AD 1700 in 500-year bins, and summer temperature for western North American (Routson et al. 2021). All series standardized to a mean of 0 and an s of 1 over the period in this graph (Routson et al. 2021 was already standardized).", echo = FALSE, warning = FALSE, message = FALSE, error = FALSE, results = 'hide', fig.keep = 'all', fig.height = 9.83, fig.width = 16.31}
viau <- paleomat::viau_2006 %>%
dplyr::mutate(time = paleomat::BPtoBCAD(time))
kaufman_standard <-
paleomat::kaufman_2020 %>%
dplyr::mutate(time = paleomat::BPtoBCAD(time_bp),
Series = "Kaufman et al. 2020") %>%
dplyr::select(year = time, anom = zscore, Series) %>%
dplyr::filter(year > -3400) %>%
dplyr::mutate(update = (anom - mean(anom, na.rm = TRUE)) / sd(anom, na.rm = TRUE))
routson_standard <-
paleomat::routson_2021 %>%
dplyr::mutate(time = paleomat::BPtoBCAD(`age (yr BP)`),
Series = "Routson et al. 2021") %>%
dplyr::select(year = time,
anom = `summer temp (zscore)`,
Series,
update = `summer temp (zscore)`) %>%
dplyr::filter(year > -3400)
temp_anom_standard <- Threebest2 %>%
dplyr::filter(Year >= -3000 & Year <= 1951) %>%
dplyr::mutate(Series = "This study") %>%
dplyr::select(year = Year, anom = .fitted, Series) %>%
dplyr::mutate(update = (anom - mean(anom, na.rm = TRUE)) / sd(anom, na.rm = TRUE))
viau_standard <- viau %>%
dplyr::mutate(Series = "Viau et al. 2006") %>%
dplyr::select(year = time, anom = temp, Series) %>%
dplyr::filter(year >= -3000 & year <= 1951) %>%
dplyr::mutate(update = (anom - mean(anom, na.rm = TRUE)) / sd(anom, na.rm = TRUE))
viau_paleomat_kaufman <-
dplyr::bind_rows(temp_anom_standard,
viau_standard,
kaufman_standard,
routson_standard)
viau_paleomat_kaufman$Series <-
factor(
viau_paleomat_kaufman$Series,
c(
"Viau et al. 2006",
"Kaufman et al. 2020",
"Routson et al. 2021",
"This study"
)
)
# Viau and paleomat
viau_paleomat_kaufman %>%
dplyr::mutate(Alpha = dplyr::case_when(Series == "This study" ~ 1,
TRUE ~ 0.65)) %>%
ggplot2::ggplot(aes(
x = year,
y = update,
colour = Series,
alpha = Alpha
)) +
geom_hline(
yintercept = 0,
color = "darkgrey",
lty = 2,
lwd = 1.25
) +
geom_line(aes(size = Series)) +
scale_size_manual(values = c(0.75, 0.75, 0.75, 2)) +
scale_alpha_identity() +
scale_color_manual(values = c("darkolivegreen", "#D55E00", "#CC79A7", "cornflowerblue")) +
scale_x_continuous(
breaks = seq(-3500, 2000, 500),
minor_breaks = seq(-3400, 1900, by = 100),
guide = "axis_minor"
) +
scale_y_continuous(breaks = seq(-2, 3.5, 0.5)) +
xlab("Years BC/AD") +
ylab("Standardized Temperature Values") +
theme_bw() +
theme(
axis.ticks.length = unit(0.125, "inch"),
ggh4x.axis.ticks.length.minor = rel(0.5),
panel.border = element_blank(),
panel.grid.major = element_blank(),
axis.text = element_text(
size = 26,
colour = "black",
family = "Helvetica"
),
axis.title.y = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 10,
r = 5,
b = 10,
l = 10
)
),
axis.title.x = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 5,
r = 10,
b = 10,
l = 10
)
),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"),
plot.margin = margin(
t = 5,
r = 25,
b = 5,
l = 5
),
legend.text = element_text(
size = 19,
family = "Helvetica",
margin = margin(b = 15, unit = "pt")
),
legend.title = element_blank()
)
# ggplot2::ggsave("vignettes/figures/Figure6.png", dpi = 600, width = 16.31, height = 9.83, units = "in")
```
```{r fig7, fig.cap="Figure 7. Low-frequency July temperature anomaly for the SWUS from this study and the Northern Hemisphere low-frequency component (Moberg et al. 2005) from AD 133 to 1900. Pages2k reconstructed NH temperatures using different proxies that combine high and low frequency data (PAGES 2k Consortium et al. 2019). All series have been standardized to a mean of 0 and an s of 1 for this period.", fig.height = 9.83, fig.width = 16.31, echo = FALSE, warning = FALSE, message = FALSE, error = FALSE, results = 'hide', fig.keep = 'all'}
temp_anom_standard <- Threebest2 %>%
dplyr::filter(Year >= 133 & Year <= 1900) %>%
dplyr::mutate(Series = "This study") %>%
dplyr::select(year = Year, anom = .fitted, Series)
Moberg_standard <- Moberg %>%
dplyr::mutate(Series = "Moberg et al. 2005") %>%
dplyr::select(year = date, anom = LF, Series) %>%
dplyr::filter(year >= 133 & year <= 1900)
pages2k_standard <-
pages2k %>%
dplyr::mutate(Series = "PAGES2K 2019") %>%
dplyr::select(year = date, anom = LF, Series) %>%
dplyr::filter(year >= 133 & year <= 1900)
Moberg_paleomat <-
dplyr::bind_rows(temp_anom_standard, Moberg_standard, pages2k_standard)
# Moberg LF, PAGES2k, and paleomat.
Moberg_paleomat %>%
dplyr::group_by(Series) %>%
dplyr::mutate(update = (anom - mean(anom, na.rm = TRUE)) / sd(anom, na.rm = TRUE)) %>%
ggplot2::ggplot(aes(x = year, y = update, colour = Series)) +
geom_hline(
yintercept = 0,
color = "darkgrey",
lty = 2,
lwd = 1.25
) +
geom_line(size = 2.0) +
scale_color_manual(values = c("#A60F2D", "#E69F00", "cornflowerblue")) +
xlab("Years AD") +
ylab("Standardized Temperature Values (Z-Scores)") +
scale_x_continuous(
limits = c(100, 1900),
breaks = seq(100, 1900, 200),
minor_breaks = seq(200, 1800, by = 200),
guide = "axis_minor"
) +
scale_y_continuous(breaks = seq(-2, 3, 0.5)) +
theme_bw() +
theme(
axis.ticks.length = unit(0.125, "inch"),
ggh4x.axis.ticks.length.minor = rel(0.5),
panel.border = element_blank(),
panel.grid.major = element_blank(),
axis.text = element_text(
size = 26,
colour = "black",
family = "Helvetica"
),
axis.title.y = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 10,
r = 5,
b = 10,
l = 10
)
),
axis.title.x = element_text(
size = 28,
family = "Helvetica",
margin = margin(
t = 5,
r = 10,
b = 10,
l = 10
)
),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"),
plot.margin = margin(
t = 5,
r = 25,
b = 5,
l = 5
),
legend.text = element_text(
size = 19,
family = "Helvetica",
margin = margin(b = 15, unit = "pt")
),
legend.title = element_blank()
)
# ggplot2::ggsave("vignettes/figures/Figure7.png", dpi = 600, width = 16.31, height = 9.83, units = "in")
```
# Tables
```{r table1, echo = FALSE, warning = FALSE, message = FALSE, error = FALSE, results = 'asis'}
# Pulling together information for Table 1, except for references, which are done elsewhere.
table1 <-
readr::read_rds(here::here("vignettes/data/pollen_cleaned/fossil_metadata_counts_final3.rds")) %>%
dplyr::filter(dataset.id %in% paleomat::bacon_age_models$dataset.id) %>%
dplyr::filter(age <= 5500) %>%
dplyr::select(site.name, site.id, dataset.id, elev) %>%
dplyr::group_by(site.name, site.id, dataset.id, elev) %>%
dplyr::count()
table1 <- elevatr::get_elev_point(table1, prj = 4326, src = "aws") %>%
dplyr::mutate(diff = abs(elevation - elev))
table1 <- table1 %>%
tidyr::extract(geometry, c('long', 'lat'), '\\((.*), (.*)\\)', convert = TRUE) %>%
dplyr::arrange(site.name) %>%
dplyr::select(
"Site Name" = site.name,
"Site ID" = site.id,
"Dataset ID" = dataset.id,
"No. of Samples" = n,
"Elevation (m)" = elevation,
"Longitude" = long,
"Latitude" = lat
)
if (!file.exists(here::here("vignettes/tables/table1.csv"))) {
write.csv(table1,
here::here("vignettes/tables/table1.csv"),
row.names = FALSE)
}
knitr::kable(table1,
caption = "Table 1. Metadata for the fossil pollen records (29 sites or 32 datasets) used in this study that have data after 3,550 BC. All data were downloaded from the Neotoma Paleoecology Database (J. W. Williams et al. 2018).")
```
# Supplemental Materials
# Supplemental Figures
```{r suppfig1, fig.cap="Supplemental Figure S1. Squared residual length for the fossil assemblages (including the 100 age-depth model simulations) vs age. Red line marks the 95% limit of the calibration set residual lengths (very poorly fitted). We removed all samples that fell above the 95% line.", fig.height = 9.83, fig.width = 16.31, echo = FALSE, warning = FALSE, message = FALSE, error = FALSE, results = 'hide', fig.keep = 'all'}
ff <-
paleomat::fossil_west_post5500 %>%
dplyr::filter(!is.na(age) & age <= 5500) %>%
dplyr::select(sample.id, age) %>%
dplyr::mutate(age = paleomat::BPtoBCAD(age)) %>%
sf::st_drop_geometry()
rlen_results_filtered <-
readr::read_rds(here::here(
"vignettes/data/diagnostics_reconstruction/rlen_full_results2.rds"
))$res_lengths
rlen_results_filtered <-
readr::read_rds(here::here("vignettes/data/diagnostics_reconstruction/sim_ages3.rds")) %>%
dplyr::filter(sample.id %in% rlen_results_filtered$sample.id) %>%
dplyr::left_join(., rlen_results_filtered, by = "sample.id")
ninety5quant <-
readr::read_rds(here::here(
"vignettes/data/diagnostics_reconstruction/rlen_full_results2.rds"
))$quantile_95
ggplot2::ggplot(data = rlen_results_filtered, aes(x = Year, y = Squared_res_lengths)) +
geom_point() +
xlab("Years BC/AD") +
ylab("Squared Residual Length") +
scale_x_continuous(
limits = c(-3500, 2100),
breaks = seq(-3500, 2000, 500),
minor_breaks = seq(-3400, 1900, by = 100),
guide = "axis_minor"
) +
scale_y_continuous(
limits = c(0, 260),
breaks = seq(0, 260, 20),
minor_breaks = seq(10, 240, 10),
guide = "axis_minor"
) +
theme_bw() +
geom_hline(
yintercept = ninety5quant,
color = "red",