-
Notifications
You must be signed in to change notification settings - Fork 0
/
comparing.qmd
158 lines (122 loc) · 5.16 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
158
---
title: "Comparisons"
---
```{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.
* Second we compare **amounts of succession classes** (past and present) for the most prevalent ecosystems.
## Comparing Broad Vegetation Trends
### Summary
* Broadly speaking, this subregion has not experienced significant ecosystem conversion to agricultural or urban land uses.
* LANDFIRE mapped a fair amount of conversion from "past shrubland" to "conifer".
* Nearly all of the land classified as present day “exotic vegetation” was converted from shrubland areas.
* 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
"#397d3f", # hardwood-conifer
"#7db7c7", # riparian
"#6e4f1e", # shrubland
"#f5e942", # cur ag
"#1d4220", # cur conifer
"#397d3f", # cur hdw-con
"#eb4034", # exotics
"#fc9d03", # grassland
"#56bf5f", # hardwood
"#b0af9e", # developed
"#7db7c7", #riparian
"#6e4f1e"# shrubland
)
#make chord diagram
chord<-chorddiag(data = matrix_df,
type = "bipartite",
groupColors = groupColors,
groupnamePadding = 10,
groupPadding = 3,
groupnameFontsize = 12 ,
showTicks = FALSE,
margin=130,
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 BpSs
- Succession classes have changed substantially in the Inter-Mountain Basins Montane Sagebrush Steppe - Mountain Big Sagebrush BpS, with significant overrepresentation of succession class C currently.
- Some BpSs appear to be missing succession classes on the landscape today, such as the Colorado Plateau Pinyon-Juniper Woodland which is missing succession class B.
```{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 = "Data from landfire.gov; Chart © Randy Swaty",
x = "",
y = "Percent")+
theme_minimal(base_size = 14)+
theme(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
```