-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomparing.qmd
159 lines (117 loc) · 4.92 KB
/
comparing.qmd
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
---
title: "Comparing Past vs. Present Conditions"
---
```{r include=FALSE, echo=FALSE, message=FALSE, warning=FALSE}
library(chorddiag)
library(htmlwidgets)
library(igraph)
library(readr)
library(tidygraph)
library(tidyverse)
```
## Comparing Past vs. Present Conditions
Using LANDFIRE’s BpS products, we explore two different ways to visualize past vs. current vegetation patterns.
- First, we present **changes in broad ecosystem types** using an interactive comparison diagram. To present these broad ecosystem trends more effectively, we combined classifications of Existing Vegetation Types (EVT) into broader categories. The Developed EVTs of high, medium, and low intensity, and Quarries-Strip Mines-Gravel Pits EVTs were combined into one "Developed" EVT. Exotic Herbaceous and Exotic Tree-shrub EVTs were combined into one "Exotics" EVT.
- Second, we compare **amounts of succession classes** (past and present) for the most prevalent ecosystems.
## Summary
* Almost all developed lands were formerly 'hardwood' ecosystems, with some coming from other broad types such as 'riparian'.
* A fair amount of what was mapped as 'hardwoods' historically was mapped as 'conifer-hardwoods' in the 2020 LANDFIRE data.
** Chord Diagram**
*Note: number presented when hovering equals acres.*
```{r chord, echo=FALSE, message=FALSE, warning=FALSE, include=FALSE}
# read in data
chord_df<- read_csv("data/bps2evt_chord.csv")
#view(histFireGVchord)
#convert to matrix
matrix_df <-as.matrix(as_adjacency_matrix(as_tbl_graph(chord_df),attr = "ACRES"))
#clean up matrix (could be cleaner!)
matrix_df = subset(matrix_df, select = -c(1:6))
matrix_df <- matrix_df[-c(7:15),]
#make a custom color pallet #eb4034 (redish) #b0af9e(grey)
# ORIGINAL
groupColors <-c( "#1d4220", # conifer
"#fc9d03", # grassland
"#56bf5f", # hardwood
"#7db7c7", # riparian
"#56bf5f", # cur hardwood
"#f5f233", # cur agriculture
"#c4c4c0", # cur developed
"#3f914b", # conifer-hardwod
"#7db7c7", # riparian
"#d95d6a", # exotics
"#fc9d03", # grassland
"#1d4220" # conifer
)
#make chord diagram
chord<-chorddiag(data = matrix_df,
type = "bipartite",
groupColors = groupColors,
groupnamePadding = 10,
groupPadding = 3,
groupnameFontsize = 11 ,
showTicks = FALSE,
margin=150,
tooltipGroupConnector = " ▶ ",
chordedgeColor = "#363533"
)
chord
#save then print to have white background
htmlwidgets::saveWidget(chord,
"chord.html",
background = "white",
selfcontained = TRUE
)
```
<iframe src="chord.html" height="720" width="720" style="border: 1px solid #464646;" allowfullscreen="" allow="autoplay" data-external=".5"></iframe>
<br>
## Succession classes for most dominant Biophysical Settings
```{r scls chart, echo=FALSE, message=FALSE, warning=FALSE, fig.width=10, fig.height=9}
BPS_SCLS2 <- read.csv("data/bpsScls2.csv")
bps_scls_3 <- BPS_SCLS2 %>%
group_by(Var1) %>%
mutate(total.count = sum(Freq)) %>%
ungroup() %>%
dplyr::filter(dense_rank(desc(total.count)) < 7) %>%
dplyr::select(c("BpS_Name", "refLabel", "currentPercent", "refPercent")) %>%
pivot_longer(
cols = c(`refPercent`, `currentPercent`),
names_to = "refCur",
values_to = "Percent"
)
# order classes
bps_scls_3$refLabel <- factor(bps_scls_3$refLabel, levels= c(
"Developed",
"Agriculture",
"UE",
"UN",
"E",
"D",
"C",
"B",
"A"))
sclasplot <-
ggplot(bps_scls_3, aes(fill=factor(refCur), y=Percent, x=refLabel)) +
geom_col(width = 0.8, position = position_dodge()) +
coord_flip() +
facet_grid(. ~BpS) +
scale_x_discrete(limits = (levels(bps_scls_3$refLabel))) +
labs(
title = "Succession Classes past and present",
subtitle = "6 BpSs selected for illustration. Not all succession classes present in all BpSs",
caption = "\nData from landfire.gov.",
x = "",
y = "Percent")+
theme_minimal(base_size = 14)+
theme(plot.caption = element_text(hjust = 0, face= "italic"), #Default is hjust=1
plot.title.position = "plot", #NEW parameter. Apply for subtitle too.
plot.caption.position = "plot") +
scale_fill_manual(values = c("#3d4740", "#32a852" ), # present (grey), historical (green)
name = " ",
labels = c("Present",
"Past")) +
facet_wrap(~BpS_Name, nrow(3),labeller = labeller(BpS_Name = label_wrap_gen())) +
theme(panel.spacing = unit(.05, "lines"),
panel.border = element_rect(color = "black", fill = NA, size = 1),
strip.background = element_rect(color = "black", size = 1))
sclasplot
```