Figures

Fig.1 Across both sexes, AH fish at significantly more than AL fish

# population alone 
fig1 <- data_forage %>% group_by(Sex) %>%
  ggplot(aes(Population, Attempts)) + 
  stat_summary(fun = mean, geom = "point") +
  stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.5) +
  geom_jitter(aes(color = Sex, shape = Sex), alpha = 0.5, width = 0.25) +
  theme_bw() +
  facet_wrap(~Sex)

fig1

Fig.2 AH and AL females reared in pred+ water ate more in pred+ test water than those reared in pred- water

fig2 <- data_forage %>% group_by(Sex, Water, Pred, Population) %>%
  ggplot(aes(x = Water, y = Attempts, color = Pred)) + 
  stat_summary(fun = mean, geom = "point") +
  stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.07) +
  scale_color_grey() +
  theme_bw() +
  facet_grid(Sex~Population) + 
  xlab('Test Water') +
  labs(color = 'Rearing Water', title = '')

fig2
## Warning: Removed 3 rows containing non-finite values (stat_summary).

## Warning: Removed 3 rows containing non-finite values (stat_summary).

# Version without male  panel
# fig2 <- subset(data_forage, Sex == 'F') %>% group_by(Water, Pred, Population) %>%
#   ggplot(aes(x = Water, y = Attempts, color = Pred)) + 
#   stat_summary(fun = mean, geom = "point") +
#   stat_summary(fun = mean, geom = "line") +
#   stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.07) +
#   scale_color_grey() +
#   theme_classic() +
#   facet_grid(~Population) + 
#   xlab('Test Water') +
#   labs(color = 'Rearing Water') +
#   ggtitle('Female')
# 
# fig2

Fig.3 Although not statistically significant, there is a trend where AH and AL males raised with AL tutors ate more in pred+ water than AH and AL males raised with AH tutors

fig3 <- data_forage %>% group_by(Sex, Water, Tutor_pop, Population) %>%
  ggplot(aes(x = Water, y = Attempts, color = Tutor_pop)) + 
  stat_summary(fun = mean, geom = "point") +
  stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.07) +
  scale_color_grey() +
  theme_bw() +
  facet_grid(Sex~Population) + 
  xlab('Test Water')

fig3
## Warning: Removed 3 rows containing non-finite values (stat_summary).

## Warning: Removed 3 rows containing non-finite values (stat_summary).

# Version without female panel
# fig3 <- subset(data_forage, Sex == 'M') %>% group_by(Water, Tutor_pop, Population) %>%
#   ggplot(aes(x = Water, y = Attempts, color = Tutor_pop)) + 
#   stat_summary(fun = mean, geom = "point") +
#   stat_summary(fun = mean, geom = "line") +
#   stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.07) +
#   scale_color_grey() +
#   theme_classic() +
#   facet_grid(~Population) + 
#   xlab('Test Water') +
#   ggtitle('Male')
# 
# fig3

Latency…stuck on what the best graphs for this sections will be…

Fig.4 Across both sexes, AH fish were quicker to eat than AL fish

fig4 <- data_forage %>% group_by(Sex) %>%
  ggplot(aes(Population, Latency)) + 
  stat_summary(fun = mean, geom = "point") +
  stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.5) +
  geom_jitter(aes(color = Sex, shape = Sex), alpha = 0.5, width = 0.25) +
  theme_bw() +
  facet_wrap(~Sex)

fig4
## Warning: Removed 3 rows containing non-finite values (stat_summary).

## Warning: Removed 3 rows containing non-finite values (stat_summary).
## Warning: Removed 3 rows containing missing values (geom_point).

Fig.5 AH males reared in pred + water were quicker to peck in both pred- and pred + test water. However, there were no effects of rearing water on time to first peck for the AL males. Although not statistically signficant, there is a trend whre AL females reared in pred+ water were quicker to peck when tested in pred+ water, but there were no differences in time to first peck between pred- and pred+ reared females when tested in pred- water.

fig5 <- data_forage %>% group_by(Sex, Water, Pred, Population) %>%
  ggplot(aes(x = Water, y = Latency, color = Pred)) +
  stat_summary(fun = mean, geom = "point") +
  stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.07) +
  scale_color_grey() +
  theme_bw() +
  facet_grid(Sex~Population) +
  xlab('Test Water') +
  labs(color = 'Rearing Water', title = '')

fig5
## Warning: Removed 3 rows containing non-finite values (stat_summary).

## Warning: Removed 3 rows containing non-finite values (stat_summary).

# fig5 <- data_forage %>% group_by(Sex, Water, Pred, Population) %>%
#   ggplot(aes(x = Pred, y = Latency, color = Water)) + 
#   stat_summary(fun = mean, geom = "point") +
#   stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.07) +
#   scale_color_grey() +
#   theme_bw() +
#   facet_grid(Sex~Population) +
#   xlab('Rearing Water')
#   #labs(color = 'Rearing Water', title = '')
# 
# fig5

Fig.6 AH females raised with AH tutors in pred + water were quicker to peck than AH females raised with AL tutors in pred+ water. There were no differences in latency to peck between tutor pops for AH females raised in pred- water. AL females raised with AH tutors in prd- water were more quicker to peck than AL females raised with AL tutors. There were no differences in latency between tutor popos for AL feamels raised in pred+ water.

fig6 <- data_forage %>% group_by(Sex, Water, Tutor_pop, Population) %>%
  ggplot(aes(x = Pred, y = Latency, color = Tutor_pop)) + 
  stat_summary(fun = mean, geom = "point") +
  stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.07) +
  scale_color_grey() +
  theme_bw() +
  facet_grid(Sex~Population) + 
  xlab('Rearing Water')

fig6
## Warning: Removed 3 rows containing non-finite values (stat_summary).

## Warning: Removed 3 rows containing non-finite values (stat_summary).

Fig1. Comparison of foraging attempts (attakcs and latency) among the two populations of origin.

fig1a <- ggplot(data_forage, aes(Population, Attempts)) +
  stat_summary(fun = mean, geom = "point") +
  stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.07) +
  geom_jitter(aes(color = Sex, shape = Sex), alpha = 0.5, width = 0.25) +
  theme_bw()
  
fig1a

fig1b <- ggplot(data_forage, aes(Population, Latency)) +
  stat_summary(fun = mean, geom = "point") +
  stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.07) +
  geom_jitter(aes(color = Sex, shape = Sex), alpha = 0.5, width = 0.25) +
  theme_bw()
  
fig1b

# Trying to facet wrap instead
fig1facet <- data_forage %>% group_by(Sex) %>%
  ggplot(aes(Population, Attempts)) + 
  stat_summary(fun = mean, geom = "point") +
  stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.5) +
  geom_jitter(aes(color = Sex, shape = Sex), alpha = 0.5, width = 0.25) +
  theme_bw() +
  facet_wrap(~Sex)

fig1facet

fig2facet <- data_forage %>% group_by(Sex) %>%
  ggplot(aes(Population, Latency)) + 
  stat_summary(fun = mean, geom = "point") +
  stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.5) +
  geom_jitter(aes(color = Sex, shape = Sex), alpha = 0.5, width = 0.25) +
  theme_bw() +
  facet_wrap(~Sex)

fig2facet

Fig2. Effect of testing water on the feeding attempts of fish from different origins, sexes, and treatments.

Plotting population differences with test water

# library(ggpubr)
# library(survminer)
# library(survival)
# 
# data_forage <- data_forage %>%
#   mutate(popwater = factor(paste(Population, Water)))
# 
# latency_female <- survfit(time2peck ~ popwater, subset(data_forage, Sex == 'F'))
# 
# ggsurvplot(latency_female, subset(data_forage, Sex == 'F'), 
#            conf.int = T, 
#            conf.int.style = c('ribbon'),
#            conf.int.alpha = .25,
#            palette = c("#A6CEE3", "#1F78B4", "#FDBF6F" ,"#FF7F00"), 
#            ylab = "Proportion of fish that have not foraged", 
#            title = "Females")
# library(tidyverse)
# 
# plot_forag <- data_forage %>%
#   filter(Sex == 'F') %>%
#   group_by(Population) %>%
#   ggplot(aes(y = Attempts, x = Pred, fill = Water)) +
#   geom_violin(alpha = 0.25, position = position_dodge(0.7)) +
#   geom_boxplot(width = 0.1, position = position_dodge(0.7)) + 
#   facet_wrap(~ Population) +
#   labs(title = "Females") +
#   stat_summary(fun.y=mean, geom="point", color = "black", 
#                shape = 4, show.legend = F, position = position_dodge(0.7)) + 
#   theme_bw()
# 
# plot_forag