Skip to content
Snippets Groups Projects
Commit 55640253 authored by Xianzong Meng's avatar Xianzong Meng
Browse files

add image saving function

parent bdc8ed91
No related branches found
No related tags found
No related merge requests found
......@@ -252,7 +252,7 @@ success_rate_70<-left_join(success_rate_70_M,success_rate_70_F)
df.SD_Rday1_140_M <- df.SD_Rday1 %>% filter(df.SD_Rday1$sex == "M",df.SD_Rday1$age == "140")
toselect_140_M <- c("group","food.distance.cm","got.food")
success_rate_140_M <- df.SD_Rday1_140_M %>% dplyr::select(toselect_140_M) %>% data.table() %>% data.table::dcast(food.distance.cm ~ ., fun=list(mean), value.var = "got.food",)
coln<-c("food.distance.cm","PND100.male.success.rate(%)")
coln<-c("food.distance.cm","PND140.male.success.rate(%)")
colnames(success_rate_140_M) <-coln
#females
df.SD_Rday1_140_F <- df.SD_Rday1 %>% filter(df.SD_Rday1$sex == "F",df.SD_Rday1$age == "140")
......@@ -424,9 +424,9 @@ geom_jitter(alpha = 0.5,width = 0.1) + labs(x = "positions", y = "foraging score
```
##general sex effect
```{r}
p_LE_backing <- ggplot(df.LE_Rday1, aes(x=trials, y=foraging.score, group=sex, colour=sex))
p_LE_foraging <- ggplot(df.LE_Rday1, aes(x=trials, y=foraging.score, group=sex, colour=sex))
colors <- c("#c6c7c9", "#d15034", "#0c0d0f", "#f1ae2d")
p_LE_backing +
p_LE_foraging +
stat_summary(fun = "mean", size = 1, geom = "line", fun.min = 'sd', fun.max = 'sd') +
stat_summary(fun.data = mean_se, geom = "errorbar", alpha=1, width=0.05, aes(colour = sex, fill = sex))+
scale_color_manual(values = colors)+
......@@ -446,6 +446,9 @@ scale_color_manual(values = colors)+
scale_y_continuous(breaks = seq(0, 7, by = 1))+
#facet_wrap(~ age, ncol = 2)
geom_jitter(alpha = 0.5,width = 0.1) + labs(x = "positions", y = "foraging score") + theme_minimal()
LE_Bday6 <- lmer(foraging.score~ sex + trials + sex:trials + (1|rat_ID),df.LE_Bday6)
eta_squared(LE_Bday6)
```
## LE rat, success rate
......@@ -482,33 +485,6 @@ success_rate<-left_join(success_rate_45,success_rate_60)
print(success_rate)
```
## distance effect, using LE 60% Bline day6
```{r}
df.LE_Bday6 <- df %>% filter(df$baseline.day == 6, df$group == "LE")
LE_Bday6_foraging<- lmer(foraging.score~ sex + food.distance.cm + sex:food.distance.cm + (1|rat_ID), df.LE_Bday6)
LE_Bday6_distance_sex<-lmer(foraging.score~ sex + food.distance.cm + (1|rat_ID), df.LE_Bday6)
LE_Bday6_distance<-lmer(foraging.score~ sex + (1|rat_ID), df.LE_Bday6)
anova(LE_Bday6_distance_sex, LE_Bday6_foraging)
anova(LE_Bday6_distance, LE_Bday6_foraging)
eta_squared(LE_Bday6_foraging)
```
## distance effect figure
```{r}
p_LE_distance <- ggplot(df.LE_Bday6, aes(x=food.distance.cm, y=foraging.score, group=sex, colour=sex))
colors <- c("#c6c7c9", "#d15034", "#0c0d0f", "#f1ae2d")
p_LE_distance +
stat_summary(fun = "mean", size = 1, geom = "line", fun.min = 'sd', fun.max = 'sd') +
stat_summary(fun.data = mean_se, geom = "errorbar", alpha=1, width=0.05, aes(colour = sex, fill = sex))+
scale_color_manual(values = colors)+
#facet_wrap(~ food.distance.cm, ncol = 2)
geom_jitter(alpha = 0.5,width = 0.1) + labs(x = "positions", y = "foraging score") + theme_minimal()
```
#------------------------------------
#### some other behavioral parameters (LE rat)
## leaving
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment