Compiled 2023-02-24 14:25:13

knitr::opts_chunk$set(echo = TRUE, warning = F, message = F, fig.path = 'figs/')

library(tidyverse)
library(lubridate)
library(gghalves)
library(patchwork)
library(colorspace)
library(extrafont)

data(oysdat)
data(sitdat)

# fml <- "CMU Serif"
fml <- "serif"
col <- scales::alpha('grey', 0.2)
colfct <- sequential_hcl(3, 'Batlow')

dat <- oysdat %>% 
  left_join(sitdat, by = 'id') %>% 
  mutate(
    age = case_when(
      inst_year >= 2018 ~ 'young', 
      inst_year < 2018 & inst_year >= 2015 ~ 'moderate', 
      inst_year < 2015 ~ 'old'
    ), 
    age = factor(age, levels = c('young', 'moderate', 'old')), 
    inst_year = case_when(
      is.na(inst_year) ~ 'unk', 
      T ~ as.character(inst_year)
    )
  ) %>% 
  filter(!is.na(site)) %>% 
  filter(!is.na(type))

# base theme
pthm <- theme_bw(base_family = fml) + 
  theme(
    legend.position = 'top',  
    panel.grid.major.x = element_blank(), 
    panel.grid.minor.x = element_blank(), 
    panel.grid.minor.y = element_blank(), 
    strip.placement = 'outside', 
    strip.background = element_blank(), 
    axis.title.x = element_blank(), 
    axis.ticks.x = element_line(), 
    axis.text.x = element_text(angle = 45, size = 8, hjust = 1), 
    legend.title = element_blank()
  )
# base theme
pthm2 <- theme_bw(base_family = fml) + 
  theme(
    legend.position = 'top',
    strip.placement = 'outside', 
    strip.background = element_blank(),  
    legend.title = element_blank()
  )

1 Figures

1.1 % live oysters

yval <- 'live_per'
ylab <- '% live oysters'
cplab <- 'Percent live oysters'
flnm <- yval

p <- ggplot(dat, aes_string(x = 'site', y = yval)) + 
  geom_half_point_panel(aes(fill = age), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  scale_fill_manual(values = colfct) +
  facet_grid(~type, scales = 'free_x', space = 'free_x') + 
  pthm + 
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '1.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '1.jpg'))
Percent live oysters __within reef type and between site__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.1: Percent live oysters within reef type and between site. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

p <- ggplot(dat, aes_string(x = 'type', y = yval)) + 
  geom_half_point_panel(aes(fill = age), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  scale_fill_manual(values = colfct) +
  facet_grid(~site, scales = 'free_x', space = 'free_x') + 
  pthm + 
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '2.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '2.jpg'))
Percent live oysters __within site and between reef type__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.2: Percent live oysters within site and between reef type. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

p <- ggplot(dat, aes_string(x = 'age', y = yval)) + 
  geom_half_point_panel(aes(fill = site), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  facet_grid(~type, scales = 'free_x', space = 'free_x') + 
  pthm + 
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '3.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '3.jpg'))
Percent live oysters __within reef type and between reef age__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.3: Percent live oysters within reef type and between reef age. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

p <- ggplot(dat, aes_string(x = 'type', y = yval)) + 
  geom_half_point_panel(aes(fill = site), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  facet_grid(~age, scales = 'free_x', space = 'free_x') + 
  pthm + 
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '4.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '4.jpg'))
Percent live oysters __within reef age and between reef type__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.4: Percent live oysters within reef age and between reef type. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

1.2 Shell total (count)

yval <- 'shell_total'
ylab <- 'Shell total (count)'
cplab <- 'Shell total (count)'
flnm <- yval

p <- ggplot(dat, aes_string(x = 'site', y = yval)) + 
  geom_half_point_panel(aes(fill = age), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  scale_fill_manual(values = colfct) +
  facet_grid(~type, scales = 'free_x', space = 'free_x') + 
  pthm +
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '1.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '1.jpg'))
Shell total (count) __within reef type and between site__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.5: Shell total (count) within reef type and between site. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

p <- ggplot(dat, aes_string(x = 'type', y = yval)) + 
  geom_half_point_panel(aes(fill = age), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  scale_fill_manual(values = colfct) +
  facet_grid(~site, scales = 'free_x', space = 'free_x') + 
  pthm + 
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '2.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '2.jpg'))
Shell total (count) __within site and between reef type__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.6: Shell total (count) within site and between reef type. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

p <- ggplot(dat, aes_string(x = 'age', y = yval)) + 
  geom_half_point_panel(aes(fill = site), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  facet_grid(~type, scales = 'free_x', space = 'free_x') + 
  pthm + 
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '3.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '3.jpg'))
Shell total (count) __within reef type and between reef age__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.7: Shell total (count) within reef type and between reef age. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

p <- ggplot(dat, aes_string(x = 'type', y = yval)) + 
  geom_half_point_panel(aes(fill = site), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  facet_grid(~age, scales = 'free_x', space = 'free_x') + 
  pthm + 
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '4.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '4.jpg'))
Shell total (count) __within reef age and between reef type__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.8: Shell total (count) within reef age and between reef type. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

1.3 Shell length (mm)

yval <- 'aveshell_mm'
ylab <- 'Shell length (mm)'
cplab <- 'Shell length (mm, average across plots)'
flnm <- yval

p <- ggplot(dat, aes_string(x = 'site', y = yval)) + 
  geom_half_point_panel(aes(fill = age), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  scale_fill_manual(values = colfct) +
  facet_grid(~type, scales = 'free_x', space = 'free_x') + 
  pthm + 
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '1.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '1.jpg'))
Shell length (mm, average across plots) __within reef type and between site__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.9: Shell length (mm, average across plots) within reef type and between site. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

p <- ggplot(dat, aes_string(x = 'type', y = yval)) + 
  geom_half_point_panel(aes(fill = age), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  scale_fill_manual(values = colfct) +
  facet_grid(~site, scales = 'free_x', space = 'free_x') + 
  pthm + 
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '2.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '2.jpg'))
Shell length (mm, average across plots) __within site and between reef type__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.10: Shell length (mm, average across plots) within site and between reef type. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

p <- ggplot(dat, aes_string(x = 'age', y = yval)) + 
  geom_half_point_panel(aes(fill = site), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  facet_grid(~type, scales = 'free_x', space = 'free_x') + 
  pthm + 
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '3.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '3.jpg'))
Shell length (mm, average across plots) __within reef type and between reef age__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.11: Shell length (mm, average across plots) within reef type and between reef age. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

p <- ggplot(dat, aes_string(x = 'type', y = yval)) + 
  geom_half_point_panel(aes(fill = site), transformation = position_jitter(width = 1, height = 0), alpha = 0.7, pch = 21, size = 2) + 
  geom_half_violin(colour = 'black', draw_quantiles = 0.5, fill = col) +
  facet_grid(~age, scales = 'free_x', space = 'free_x') + 
  pthm + 
  labs(
    y = ylab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '4.jpg'), height = 4, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '4.jpg'))
Shell length (mm, average across plots) __within reef age and between reef type__. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

Figure 1.12: Shell length (mm, average across plots) within reef age and between reef type. The left half of values show a density histogram and the right half shows percent live oysters for a plot at each site.

1.4 % live oyster vs shell total (count)

xvar <- 'shell_total'
yvar <- 'live_per'
xlab <- 'Shell total (count)'
ylab <- '% live oysters'
flnm <- 'livvstot'
cplab <- 'Percent live oysters vs total shell count'

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = age), alpha = 0.7, pch = 21, size = 2) + 
  scale_fill_manual(values = colfct) +
  # stat_smooth() + 
  facet_grid(~type, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '1.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '1.jpg'))
Percent live oysters vs total shell count __within reef type and between reef age__.

Figure 1.13: Percent live oysters vs total shell count within reef type and between reef age.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = type), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~age, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '2.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '2.jpg'))
Percent live oysters vs total shell count __within reef age and between reef type__.

Figure 1.14: Percent live oysters vs total shell count within reef age and between reef type.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = site), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~type, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '3.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '3.jpg'))
Percent live oysters vs total shell count __within reef type and between site__.

Figure 1.15: Percent live oysters vs total shell count within reef type and between site.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = type), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~site, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '4.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '4.jpg'))
Percent live oysters vs total shell count __within site and between reef type__.

Figure 1.16: Percent live oysters vs total shell count within site and between reef type.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = age), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  scale_fill_manual(values = colfct) +
  facet_grid(~site, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '5.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '5.jpg'))
Percent live oysters vs total shell count __within site and between reef age__.

Figure 1.17: Percent live oysters vs total shell count within site and between reef age.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = site), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~age, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '6.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '6.jpg'))
Percent live oysters vs total shell count __within reef age and between site__.

Figure 1.18: Percent live oysters vs total shell count within reef age and between site.

1.5 % live oyster vs shell length (mm)

xvar <- 'aveshell_mm'
yvar <- 'live_per'
xlab <- 'Shell length (mm)'
ylab <- '% live oysters'
flnm <- 'livvslen'
cplab <- 'Percent live oysters vs average shell length (mm)'

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = age), alpha = 0.7, pch = 21, size = 2) + 
  scale_fill_manual(values = colfct) +
  # stat_smooth() + 
  facet_grid(~type, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '1.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '1.jpg'))
Percent live oysters vs average shell length (mm) __within reef type and between reef age__.

Figure 1.19: Percent live oysters vs average shell length (mm) within reef type and between reef age.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = type), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~age, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '2.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '2.jpg'))
Percent live oysters vs average shell length (mm) __within reef age and between reef type__.

Figure 1.20: Percent live oysters vs average shell length (mm) within reef age and between reef type.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = site), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~type, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '3.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '3.jpg'))
Percent live oysters vs average shell length (mm) __within reef type and between site__.

Figure 1.21: Percent live oysters vs average shell length (mm) within reef type and between site.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = type), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~site, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '4.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '4.jpg'))
Percent live oysters vs average shell length (mm) __within site and between reef type__.

Figure 1.22: Percent live oysters vs average shell length (mm) within site and between reef type.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = age), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  scale_fill_manual(values = colfct) +
  facet_grid(~site, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '5.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '5.jpg'))
Percent live oysters vs average shell length (mm) __within site and between reef age__.

Figure 1.23: Percent live oysters vs average shell length (mm) within site and between reef age.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = site), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~age, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '6.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '6.jpg'))
Percent live oysters vs average shell length (mm) __within reef age and between site__.

Figure 1.24: Percent live oysters vs average shell length (mm) within reef age and between site.

1.6 shell length (mm) vs shell total (count)

xvar <- 'shell_total'
yvar <- 'aveshell_mm'
xlab <- 'Shell total (count)'
ylab <- 'Shell length (mm)'
flnm <- 'lenvstot'
cplab <- 'Average shell length (mm) vs total shell count'

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = age), alpha = 0.7, pch = 21, size = 2) + 
  scale_fill_manual(values = colfct) +
  # stat_smooth() + 
  facet_grid(~type, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '1.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '1.jpg'))
Average shell length (mm) vs total shell count __within reef type and between reef age__.

Figure 1.25: Average shell length (mm) vs total shell count within reef type and between reef age.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = type), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~age, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '2.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '2.jpg'))
Average shell length (mm) vs total shell count __within reef age and between reef type__.

Figure 1.26: Average shell length (mm) vs total shell count within reef age and between reef type.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = site), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~type, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '3.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '3.jpg'))
Average shell length (mm) vs total shell count __within reef type and between site__.

Figure 1.27: Average shell length (mm) vs total shell count within reef type and between site.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = type), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~site, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '4.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '4.jpg'))
Average shell length (mm) vs total shell count __within site and between reef type__.

Figure 1.28: Average shell length (mm) vs total shell count within site and between reef type.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = age), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  scale_fill_manual(values = colfct) +
  facet_grid(~site, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '5.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '5.jpg'))
Average shell length (mm) vs total shell count __within site and between reef age__.

Figure 1.29: Average shell length (mm) vs total shell count within site and between reef age.

p <- ggplot(dat, aes_string(x = xvar, y = yvar)) + 
  geom_point(aes(fill = site), alpha = 0.7, pch = 21, size = 2) + 
  # stat_smooth() + 
  facet_grid(~age, scales = 'free_x') + 
  pthm2 +
  labs(
    y = ylab, 
    x = xlab
  ) + 
  guides(fill = guide_legend(nrow = 1))
  
jpeg(paste0('figs/', flnm, '6.jpg'), height = 3.5, width = 9, units = 'in', res = 300, family = fml)
print(p)
dev.off()
knitr::include_graphics(paste0('figs/', flnm, '6.jpg'))
Average shell length (mm) vs total shell count __within reef age and between site__.

Figure 1.30: Average shell length (mm) vs total shell count within reef age and between site.