##################################################### # Marco FW Gauger # 2021/02/23 # # This is the script to obtain fig S 3 of the supplementary material of the manuscript submitted to PeerJ Gauger et al 2021 Diel influences on bottlenose dolphin acoustic detection in a coastal lagoon in the southwestern Gulf of California ##################################################### ifelse("corrplot" %in% rownames(installed.packages()) == FALSE, install.packages("corrplot", dependencies = T), ("corrplot is already installed")) ifelse("GGally" %in% rownames(installed.packages()) == FALSE, install.packages("GGally", dependencies = T), ("GGally is already installed")) ifelse("ggcorrplot" %in% rownames(installed.packages()) == FALSE, install.packages("ggcorrplot", dependencies = T), ("ggcorrplot is already installed")) ifelse("dplyr" %in% rownames(installed.packages()) == FALSE, install.packages("dplyr", dependencies = T), ("dplyr is already installed")) require(corrplot) require(GGally) require(ggcorrplot) require(dplyr) ######## Sys.setlocale("LC_ALL","English") #Sys.setenv(TZ='UTC') analysed_data_hour <- read.csv("Supplemental Data S1.csv", sep=";") analysed_data_hour$cluster_hcpc <- as.factor(analysed_data_hour$cluster_hcpc) unique(analysed_data_hour$month_campaign) cor_data <- as.data.frame(cbind(analysed_data_hour$lunar_phase, analysed_data_hour$tide, analysed_data_hour$flow, analysed_data_hour$derivate_tide, analysed_data_hour$SST_BLAP, analysed_data_hour$SST, analysed_data_hour$delta_SST, analysed_data_hour$CHL_BLAP, analysed_data_hour$distance_BLAP, analysed_data_hour$distance_coast, analysed_data_hour$distance_mangrove, analysed_data_hour$depth, analysed_data_hour$effort, analysed_data_hour$h)) names(cor_data) <- c("moon","tide","flow","derivate tide","SST_BLAP","SST","delta_SST","CHL","BLAP","coast","mangrove","depth", "effort", "hour") #names(cor_data) <- c("luna","marea","corriente","derivada corriente","SST_BLAP","SST","delta_SST","CHL","BLAP","costa","manglar","profundidad", "esfuerzo", "hora") head(cor_data) unique(is.na(cor_data)) M <- cor(cor_data, method=c("spearman")) res1 <- cor.mtest(cor_data, conf.level = 0.95) res2 <- cor.mtest(cor_data, conf.level = 0.99) p.mat <- cor_pmat(cor_data) head(p.mat[, 1:4]) rownames(p.mat) <- as.numeric(rownames(p.mat) ) p.mat$SST <- as.numeric(p.mat$SST) (ggcorrplot_dp10m <- ggcorrplot(M, hc.order = TRUE, type = "lower", p.mat = p.mat, insig = "blank", lab = TRUE, lab_size=2)) ggsave("Figure S3.png", plot=ggcorrplot_dp10m, dpi=300, width = 15, height = 15, units = "cm")