Last active
January 15, 2021 22:57
-
-
Save dlebauer/d02e20e7d0ed40556ce5fee6f61f8dfe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(wesanderson) | |
library(cowplot) | |
library(lubridate) | |
allfields <- read_csv('~/Downloads/canopycover_ratiomask.csv') %>% | |
mutate(method = 'French') | |
field3 <- read_csv('~/Downloads/canopycover_ratiomask_field3.csv') %>% | |
mutate(method = 'French') | |
all_tr <- read_csv('~/Downloads/allcanopycover (1).csv') %>% select(-X1) %>% | |
mutate(method = 'Li') | |
field3_mean <- field3 %>% group_by(local_datetime) %>% | |
summarise(canopy_cover = mean(canopy_cover)) | |
field3_ortho <- allfields %>% filter(site == 3) | |
f3 <- ggplot(data = field3, aes(local_datetime, canopy_cover)) + | |
geom_point(aes(group = site), alpha = 0.1, size = 0.4) + | |
geom_line(aes(group = site), alpha = 0.1, size = 0.4) + theme_bw() + ggtitle("Field 3; \n red = mean across plots \n blue = integrated over full field") + ylim(0,100) + | |
geom_line(data = field3_mean, color = 'red') + | |
geom_line(data = field3_ortho, color = 'blue') | |
af <- ggplot(data = allfields, aes(local_datetime, canopy_cover, color = site)) + | |
geom_point() + | |
geom_line() + theme_bw() + ggtitle("All fields, integrated over each field") + ylim(0,100) + theme(legend.position = c(0.1, 0.6), legend.box.background = element_rect(fill = "transparent")) | |
cowplot::plot_grid(f3,af, ncol = 1) | |
allall <- bind_rows(all_tr, allfields) | |
alljoin <- all_tr %>% full_join(allfields, by = c("local_datetime", "species", "site"), suffix = c('_li', '_french')) %>% | |
mutate(dap = as.integer(as_date(local_datetime) - min(as_date(local_datetime)))) | |
z1 <- wes_palette(name="Zissou1", n=5, type = "continuous") | |
ggplot(alljoin) + | |
geom_point(aes(canopy_cover_li, canopy_cover_french, color = dap), size = 0.4) + | |
geom_abline() + theme_bw() + | |
scale_color_gradientn(colours = z1) | |
ggplot(alljoin) + | |
geom_histogram(aes(canopy_cover_li - canopy_cover_french)) | |
dj1 <- wes_palette(name="Darjeeling2", n=5, type = "continuous") | |
compare_methods <- | |
ggplot(data = allall, | |
aes(local_datetime, canopy_cover, color = site)) + | |
geom_point() + | |
geom_line(aes(linetype = method)) + | |
theme_bw() + ggtitle("All fields, integrated over each field, comparing methods") + ylim(0,100) + theme(legend.position = c(0.1, 0.5), legend.box.margin = margin(0,0,0,0)) + | |
scale_color_manual(values = dj1) | |
cowplot::plot_grid(f3, compare_methods, ncol = 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment