library(dplyr)
library(lubridate)
library(ggridges)
library(ggplot2)
pico <- read.csv('19980101_20211231-OCCCI_GLOBCOLOUR-PICO_PERCENTAGE-STATS_ANOMS-NES_EPU_NOESTUARIES-SOE_V2022-SOE_FORMAT.csv')
nano <- read.csv('19980101_20211231-OCCCI_GLOBCOLOUR-NANO_PERCENTAGE-STATS_ANOMS-NES_EPU_NOESTUARIES-SOE_V2022-SOE_FORMAT.csv')
micro <- read.csv('19980101_20211231-OCCCI_GLOBCOLOUR-MICRO_PERCENTAGE-STATS_ANOMS-NES_EPU_NOESTUARIES-SOE_V2022-SOE_FORMAT.csv')
pico$date <- ymd_hms(pico$TIME_START)
nano$date <- ymd_hms(nano$TIME_START)
micro$date <- ymd_hms(micro$TIME_START)
pico$size_class <- 'pico'
nano$size_class <- 'nano'
micro$size_class <- 'micro'
pico <- pico %>%
mutate(year = year(date),
week = week(date)) %>%
filter(VARIABLE == 'WEEKLY_PICO_PERCENTAGE_MEDIAN') %>%
dplyr::select('date', 'year', 'week', 'SUBAREA', 'VALUE', 'size_class') %>%
rename_all(., .funs = tolower)
nano <- nano %>%
mutate(year = year(date),
week = week(date)) %>%
filter(VARIABLE == 'WEEKLY_NANO_PERCENTAGE_MEDIAN') %>%
dplyr::select('date', 'year', 'week', 'SUBAREA', 'VALUE','size_class') %>%
rename_all(., .funs = tolower)
micro <- micro %>%
mutate(year = year(date),
week = week(date)) %>%
filter(VARIABLE == 'WEEKLY_MICRO_PERCENTAGE_MEDIAN') %>%
dplyr::select('date', 'year', 'week', 'SUBAREA', 'VALUE','size_class') %>%
rename_all(., .funs = tolower)
# Generate a dataframe with all size classes
df <- rbind(pico, nano, micro)
ggplot(df, aes(x = value, y = factor(year), fill = size_class)) +
geom_density_ridges(alpha = .8, color = 'white',
scale = 2.5, rel_min_height = .01) +
labs(x = 'Percent composition', y = 'Year') +
scale_fill_cyclical(name = "Phytoplankton Size Class:",
guide = "legend",
labels = c('pico' = 'Pico, < 2.0 um)',
'nano' = 'Nano, 2.0 - 20 um',
'micro' = 'Micro 20 - 200 um'),
values = c("tomato", "dodgerblue", 'goldenrod')) +
facet_wrap(~subarea)+
theme_ridges()
df_1721 <- df %>%
filter(year %in% c(2017,2021))
df_08_1721 <- df_1721 %>%
filter(week %in% c(31:35))
ggplot(df_1721, aes(x = value, y = factor(year), fill = size_class)) +
geom_density_ridges(alpha = .8, color = 'white',
scale = 2.5, rel_min_height = .01) +
labs(x = 'Percent composition', y = 'Year') +
theme_ridges() +
scale_fill_cyclical(name = "Phytoplankton Size Class:",
guide = "legend",
labels = c('pico' = 'Pico, < 2.0 um)',
'nano' = 'Nano, 2.0 - 20 um',
'micro' = 'Micro 20 - 200 um'),
values = c("tomato", "dodgerblue", 'goldenrod')) +
facet_wrap(~subarea)
Just the month of August in the 2017 vs 2021
ggplot(df_08_1721, aes(x = value, y = factor(year), fill = size_class)) +
geom_density_ridges(alpha = .8, color = 'white',
scale = 2.5, rel_min_height = .01) +
labs(x = 'Percent composition: August', y = 'Year') +
theme_ridges() +
scale_fill_cyclical(name = "Phytoplankton Size Class:",
guide = "legend",
labels = c('pico' = 'Pico, < 2.0 um)',
'nano' = 'Nano, 2.0 - 20 um',
'micro' = 'Micro 20 - 200 um'),
values = c("tomato", "dodgerblue", 'goldenrod')) +
facet_wrap(~subarea)
Just the month of August across all years, the switch of pico and micro is anomalous in 2021
df_aug <- df %>%
filter(week %in% c(31:35))
ggplot(df_aug, aes(x = value, y = factor(year), fill = size_class)) +
geom_density_ridges(alpha = .8, color = 'white',
scale = 2.5, rel_min_height = .01) +
labs(x = 'Percent composition: August', y = 'Year') +
theme_ridges() +
scale_fill_cyclical(name = "Phytoplankton Size Class:",
guide = "legend",
labels = c('pico' = 'Pico, < 2.0 um)',
'nano' = 'Nano, 2.0 - 20 um',
'micro' = 'Micro 20 - 200 um'),
values = c("tomato", "dodgerblue", 'goldenrod')) +
facet_wrap(~subarea)
p_1721 <-pico %>%
filter(year %in% c(2017,2021))
ggplot(p_1721, aes(x = value, y = factor(year), fill = year)) +
geom_density_ridges(alpha = .8, color = 'white',
scale = 2.5, rel_min_height = .01) +
labs(x = 'Percent Pico-phytoplankton', y = 'Year', title = 'All Months') +
guides(fill = FALSE) +
theme_ridges() +
facet_wrap(~subarea)
p_08_1721 <-pico %>%
filter(week %in% c(31:35))
ggplot(p_08_1721, aes(x = value, y = factor(year), fill = year)) +
geom_density_ridges(alpha = .8, color = 'white',
scale = 2.5, rel_min_height = .01) +
labs(x = 'Percent Pico-phytoplankton', y = 'Year', title = 'August') +
guides(fill = FALSE) +
theme_ridges() +
facet_wrap(~subarea)
n_1721 <-nano %>%
filter(year %in% c(2017,2021))
ggplot(n_1721, aes(x = value, y = factor(year), fill = year)) +
geom_density_ridges(alpha = .8, color = 'white',
scale = 2.5, rel_min_height = .01) +
labs(x = 'Percent Nano-phytoplankton', y = 'Year', title = 'All Months') +
guides(fill = FALSE) +
theme_ridges() +
facet_wrap(~subarea)
n_08_1721 <-nano %>%
filter(week %in% c(31:35))
ggplot(n_08_1721, aes(x = value, y = factor(year), fill = year)) +
geom_density_ridges(alpha = .8, color = 'white',
scale = 2.5, rel_min_height = .01) +
labs(x = 'Percent Nano-phytoplankton', y = 'Year', title = 'August') +
guides(fill = FALSE) +
theme_ridges() +
facet_wrap(~subarea)
m_1721 <-micro %>%
filter(year %in% c(2017,2021))
ggplot(m_1721, aes(x = value, y = factor(year), fill = year)) +
geom_density_ridges(alpha = .8, color = 'white',
scale = 2.5, rel_min_height = .01) +
labs(x = 'Percent Micro-phytoplankton', y = 'Year', title = 'All Months') +
guides(fill = FALSE) +
theme_ridges() +
facet_wrap(~subarea)
m_08_1721 <- micro %>%
filter(week %in% c(31:35))
ggplot(m_08_1721, aes(x = value, y = factor(year), fill = year)) +
geom_density_ridges(alpha = .8, color = 'white',
scale = 2.5, rel_min_height = .01) +
labs(x = 'Percent Micro-phytoplankton', y = 'Year', title = 'August') +
guides(fill = FALSE) +
theme_ridges() +
facet_wrap(~subarea)