Load libraries:
library(ggplot2)
library(dplyr)
Import the data, filter polar studies and separate by sampling depth.
data <- read.table('field_data.txt', header = T)
data$alatitude <- abs(data$latitude)
# Quantifying the relative proportion of mixotrophs to total phagotrophs:
data$pmixophago <- 100 * data$mnf/(data$mnf + data$hnf)
# Quantifying the relative proportion of mixotrophs to total phagotrophs:
data$pmixophoto <- 100 * data$mnf/(data$mnf + data$anf)
# Weighting to get "community mixotrophy"
tot <- data$mnf + data$anf + data$hnf
data$phot <- 0.5 * (data$mnf/tot) + 1.0 * (data$anf/tot)
data$phag <- 0.5 * (data$mnf/tot) + 1.0 * (data$hnf/tot)
data_polar <- data %>%
filter(study == "S3" | study == "S17" | study == "S19")
data_polar$season <- factor(data_polar$season, levels = c("spring", "summer", "early-autumn"))
data_surface <- data_polar %>%
filter(depth == "surface")
data_dcm <- data_polar %>%
filter(depth == "DCM")
data_surface %>%
group_by(season) %>%
summarise_at(vars(mnpp:npratio, bacteria:mnf, chla:PAR), mean, na.rm = TRUE)
## # A tibble: 3 x 13
## season mnpp vnpp nitrate phosphate npratio bacteria anf hnf mnf chla
## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 spring 0.532 0.104 28.8 1.96 14.7 5513077. 2531. 555. 93.5 1.55
## 2 summer 0.683 0.104 20.6 1.39 15.1 368769. 1405. 353. 191. 1.87
## 3 early~ 0.215 0.132 0.538 0.952 0.485 214700 44.6 106. 10.9 0.252
## # ... with 2 more variables: temperature <dbl>, PAR <dbl>
data_dcm %>%
group_by(season) %>%
summarise_at(vars(mnpp:npratio, bacteria:mnf, chla:PAR), mean, na.rm = TRUE)
## # A tibble: 2 x 13
## season mnpp vnpp nitrate phosphate npratio bacteria anf hnf mnf chla
## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 summer 0.683 0.104 25.0 1.64 15.3 440538. 1213. 342. 192. 1.87
## 2 early~ 0.215 0.132 5.12 1.41 3.42 179900 68.6 86.4 10.5 0.3
## # ... with 2 more variables: temperature <dbl>, PAR <dbl>
# Settings for plots
mytheme <- theme(panel.grid.minor = element_blank(),
panel.grid.major = element_blank(),
panel.background = element_rect(colour = "black", fill = "white", size=1),
axis.text=element_text(size=16, colour ="black"),
axis.title=element_text(size=18, colour ="black"),
axis.ticks.length = unit(.25, "cm"),
plot.margin = unit(c(1, 1.5, 0.5, 0.5), "lines"),
legend.position = 'right',
#legend.title = element_blank(),
legend.text = element_text(size=16, colour ="black"),
legend.title = element_text(size=16, colour ="black"),
plot.title = element_text(hjust = -0.28, face = "bold", size = 25),
strip.background = element_rect(colour="black", fill="white"),
strip.text = element_text(size = 16)
)
ggplot(data = data_surface, aes(x = season, y = log(bacteria + 1))) +
geom_boxplot() +
ylab("Bacteria (cells/mL) - surface") +
mytheme
ggplot(data = data_surface, aes(x = season, y = PAR)) +
geom_boxplot() +
ylab("PAR (mol photons/m2/day) - surface") +
mytheme
ggplot(data = data_surface, aes(x = season, y = nitrate)) +
geom_boxplot() +
ylab("Nitrate (uM) - surface") +
mytheme
ggplot(data = data_surface, aes(x = season, y = mnf)) +
geom_boxplot() +
ylab("MNF (cells/mL)") +
mytheme
ggplot(data = data_surface, aes(x = season, y = anf)) +
geom_boxplot() +
ylab("ANF (cells/mL)") +
mytheme
ggplot(data = data_surface, aes(x = season, y = hnf)) +
geom_boxplot() +
ylab("HNF (cells/mL)") +
mytheme
ggplot(data = data_surface, aes(x = season, y = pmixophago)) +
geom_boxplot() +
ylab("MNF:(MNF + HNF)") +
mytheme
ggplot(data = data_surface, aes(x = season, y = pmixophoto)) +
geom_boxplot() +
ylab("MNF:(MNF + ANF)") +
mytheme
ggplot(data = data_surface, aes(x = season, y = phot)) +
geom_boxplot() +
ylab("Community phototrophy (surface)") +
mytheme
ggplot(data = data_dcm, aes(x = season, y = phot)) +
geom_boxplot() +
ylab("Community phototrophy (DCM)") +
mytheme
ggplot(data = data_polar, aes(x = season, y = phot)) +
geom_boxplot() +
ylab("Community phototrophy (all depths)") +
mytheme
data_olig <- data %>%
filter(study == "S1" | study == "S2")
data_olig$season <- factor(data_olig$season, levels = c("spring", "summer", "autumn"))
data_surface <- data_olig %>%
filter(depth == "surface")
data_dcm <- data_olig %>%
filter(depth == "DCM")
data_surface %>%
group_by(season) %>%
summarise_at(vars(mnpp:npratio, bacteria:mnf, chla:PAR), mean, na.rm = TRUE)
## # A tibble: 3 x 13
## season mnpp vnpp nitrate phosphate npratio bacteria anf hnf mnf chla
## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 spring 0.5 0.0129 0.005 0.1 0.05 390000 175 974 22 0.05
## 2 summer 0.538 0.0354 0.198 0.0549 3.60 545000 1634 1358. 192. 1.1
## 3 autumn 0.865 0.0747 2.95 0.654 4.51 2225000 4510 1305 135 3.47
## # ... with 2 more variables: temperature <dbl>, PAR <dbl>
data_dcm %>%
group_by(season) %>%
summarise_at(vars(mnpp:npratio, bacteria:mnf, chla:PAR), mean, na.rm = TRUE)
## # A tibble: 2 x 13
## season mnpp vnpp nitrate phosphate npratio bacteria anf hnf mnf
## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 spring 0.5 0.0129 1.06 0.345 3.06 283500 1172. 809 1.75
## 2 summer 0.285 0.0129 0.18 0.06 3 126833. 706. 275. 18.2
## # ... with 3 more variables: chla <dbl>, temperature <dbl>, PAR <dbl>
ggplot(data = data_olig, aes(x = season, y = log(bacteria + 1))) +
geom_boxplot() +
ylab("Bacteria (cells/mL)") +
mytheme
ggplot(data = data_olig, aes(x = season, y = PAR)) +
geom_boxplot() +
ylab("PAR (mol photons/m2/day)") +
mytheme
ggplot(data = data_olig, aes(x = season, y = nitrate)) +
geom_boxplot() +
ylab("Nitrate (uM)") +
mytheme
ggplot(data = data_olig, aes(x = season, y = mnf)) +
geom_boxplot() +
ylab("MNF (cells/mL)") +
mytheme
ggplot(data = data_olig, aes(x = season, y = anf)) +
geom_boxplot() +
ylab("ANF (cells/mL)") +
mytheme
ggplot(data = data_olig, aes(x = season, y = hnf)) +
geom_boxplot() +
ylab("HNF (cells/mL)") +
mytheme
ggplot(data = data_olig, aes(x = season, y = pmixophago)) +
geom_boxplot() +
ylab("MNF:(MNF+HNF)") +
mytheme
ggplot(data = data_olig, aes(x = season, y = pmixophoto)) +
geom_boxplot() +
ylab("MNF:(MNF+ANF)") +
mytheme
ggplot(data = data_olig, aes(x = season, y = phot)) +
geom_boxplot() +
ylab("Community phototrophy") +
mytheme