-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBegin_plotmaps.R
More file actions
44 lines (35 loc) · 1.4 KB
/
Copy pathBegin_plotmaps.R
File metadata and controls
44 lines (35 loc) · 1.4 KB
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
#These are BEGIN plot maps. Run this and then run the R markdown to make a fancy document.
## ---- Maps
source("BEGIN Data loading and cleaning.R")
# BeginThinDraft %>% filter(Species == "Holcus mollis") %>%
# mutate(Cover = as.numeric(Cover),
# Plot = as.numeric(Plot),
# Block = factor(Block, levels = rev(LETTERS[1:5])),
# Cover = if_else(Cover == 0, NA_real_, Cover)) %>%
# ggplot(aes(x = (Plot - 1) %% 3, y = (Plot - 1) %/% 3, fill = Cover)) +
# geom_raster() +
# facet_grid(Block ~ Year) +
# scale_fill_viridis_c()+
# scale_x_continuous(expand = c(0, 0)) +
# scale_y_continuous(expand = c(0, 0)) +
# theme_classic() +
# theme(axis.title = element_blank())
## ---- begin_maps
for (sp in sort(unique(BeginThinDraft$Species))) {
h <- BeginThinDraft %>% filter(Species == sp) %>%
mutate(Cover = as.numeric(Cover),
Plot = as.numeric(Plot),
Block = factor(Block, levels = rev(LETTERS[1:5])),
Cover = if_else(Cover == 0, NA_real_, Cover)) %>%
ggplot(aes(x = (Plot - 1) %% 3, y = (Plot - 1) %/% 3, fill = Cover)) +
geom_raster() +
facet_grid(Block ~ Year) +
scale_fill_viridis_c(limits = c(0, 100)) +
scale_x_continuous(expand = c(0, 0)) +
scale_y_continuous(expand = c(0, 0)) +
theme_classic() +
theme(axis.title = element_blank()) +
ggtitle(sp)
#ggsave(paste0("Maps/",i,".png"))
print(h)
}