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

color change

parent 19f574e2
No related branches found
No related tags found
No related merge requests found
......@@ -223,14 +223,14 @@ anova(ESPND140,ESPND140_sex)
SD_Rday1_sum<-df.SD_Rday1 %>% group_by(trials, age) %>% summarize(percentage = sum(foraging.score != 7)/n())
Fig1a <-ggbarplot(SD_Rday1_sum, x="trials", y="percentage",
color = "age", palette = c("#7fc97f", "#fdc086"),
size = 2, ylab = "foraging success [%]",
color = "age", palette = c("#66C2A5", "#FC8D62"),
size = 2, ylab = "foraging success [%]",xlab = "positions",
position = position_dodge(1))
Fig1b<- ggplot(df.SD_Rday1, aes(x=trials, y=foraging.score, group=rat_ID)) + geom_line(color="gray", alpha=0.2)+
stat_summary(fun=mean, aes(group = age, color= age), geom="line", linewidth=2)+
stat_summary(fun.data = mean_se, aes(group=age, color = age), geom = "errorbar", alpha=1, width=0.05)+
scale_color_manual(values = c("#7fc97f", "#fdc086"))+
scale_color_manual(values = c("#66C2A5", "#FC8D62"))+
scale_y_continuous(breaks = seq(0, 7, by = 1))+
labs(x = "positions", y = "foraging score") + theme_classic() + facet_wrap(~age, ncol=2)
......@@ -374,16 +374,16 @@ anova(ESrestriction60,ESrestriction60_sex)
LE_Rday1_sum<-df.LE_Rday1 %>% group_by(trials, restriction) %>% summarize(percentage = sum(foraging.score != 7)/n())
Fig2a <-ggbarplot(LE_Rday1_sum, x="trials", y="percentage",
color = "restriction", palette = c("#beaed4", "#ffff99"),
size = 2, ylab = "foraging success [%]",
color = "restriction", palette = c("#8DA0CB", "#E78AC3"),
size = 2, ylab = "foraging success [%]",xlab = "positions",
position = position_dodge(1))
Fig2b<- ggplot(df.LE_Rday1, aes(x=trials, y=foraging.score, group=rat_ID)) + geom_line(color="gray", alpha=0.2)+
stat_summary(fun=mean, aes(group = restriction, color= restriction), geom="line", linewidth=2)+
stat_summary(fun.data = mean_se, aes(group=restriction, color = restriction), geom = "errorbar", alpha=1, width=0.05)+
scale_color_manual(values = c("#beaed4", "#ffff99"))+
scale_color_manual(values = c("#8DA0CB", "#E78AC3"))+
scale_y_continuous(breaks = seq(0, 7, by = 1))+
labs(x = "positions", y = "foraging score") + theme_classic() + facet_wrap(~restriction, ncol=2)
labs(x = "positions", y = "foraging score") + theme_classic() + facet_wrap(~restriction, ncol=2,labeller = labeller(group = c("45" = "45%", "60" = "60%")))
Fig2a_2b <- ggarrange(Fig2a, Fig2b, ncols=2,labels=c('A','B'), common.legend=TRUE,legend="right", widths=c(1,2))
Fig2a_2b
......@@ -398,7 +398,7 @@ Fig_SD_sex_age_70 <- EFsex_age_70 +
geom_line(color="gray", alpha=0.2)+
stat_summary(fun = "mean", size = 1, aes(group = sex, color= sex), geom = "line", fun.min = 'sd', fun.max = 'sd') +
stat_summary(fun.data = mean_se, geom = "errorbar", aes(group=sex, color = sex), alpha=1, width=0.05)+
scale_color_manual(values = c("#fb9a99", "#a6cee3"))+
scale_color_manual(values = c("#66C2A5", "#66C2A5"))+
scale_y_continuous(breaks = seq(0, 7, by = 1))+
labs(x = "positions", y = "foraging score") + theme_classic() + facet_wrap(~ sex, ncol = 2)
Fig_SD_sex_age_70
......@@ -412,7 +412,7 @@ Fig_SD_sex_age_140 <- EFsex_age_140 +
geom_line(color="gray", alpha=0.2)+
stat_summary(fun = "mean", size = 1,aes(group = sex, color= sex),geom = "line", fun.min = 'sd', fun.max = 'sd') +
stat_summary(fun.data = mean_se,aes(group = sex, color= sex),geom = "errorbar", alpha=1, width=0.05)+
scale_color_manual(values = c("#fb9a99", "#a6cee3"))+
scale_color_manual(values = c("#FC8D62", "#FC8D62"))+
scale_y_continuous(breaks = seq(0, 7, by = 1))+
labs(x = "positions", y = "foraging score") + theme_classic() + facet_wrap(~ sex, ncol = 2)
Fig_SD_sex_age_140
......@@ -426,7 +426,7 @@ Fig_LE_sex_restriction_45 <- EFsex_restriction_45 +
geom_line(color="gray", alpha=0.2)+
stat_summary(fun = "mean", size = 1, aes(group = sex, color= sex),geom = "line", fun.min = 'sd', fun.max = 'sd') +
stat_summary(fun.data = mean_se, aes(group = sex, color= sex),geom = "errorbar", alpha=1, width=0.05)+
scale_color_manual(values = c("#fb9a99", "#a6cee3"))+
scale_color_manual(values = c("#8DA0CB", "#8DA0CB"))+
scale_y_continuous(breaks = seq(0, 7, by = 1))+
labs(x = "positions", y = "foraging score") + theme_classic() + facet_wrap(~ sex, ncol = 2)
Fig_LE_sex_restriction_45
......@@ -440,7 +440,7 @@ Fig_LE_sex_restriction_60 <- EFsex_restriction_60 +
geom_line(color="gray", alpha=0.2)+
stat_summary(fun = "mean", size = 1, aes(group = sex, color= sex), geom = "line", fun.min = 'sd', fun.max = 'sd') +
stat_summary(fun.data = mean_se, aes(group = sex, color= sex), geom = "errorbar", alpha=1, width=0.05)+
scale_color_manual(values = c("#fb9a99", "#a6cee3"))+
scale_color_manual(values = c("#E78AC3", "#E78AC3"))+
scale_y_continuous(breaks = seq(0, 7, by = 1))+
labs(x = "positions", y = "foraging score") + theme_classic() + facet_wrap(~ sex, ncol = 2)
Fig_LE_sex_restriction_60
......@@ -454,7 +454,7 @@ Fig_LE_sex_general <- p_LE_foraging +
geom_line(color="gray", alpha=0.2)+
stat_summary(fun = "mean", size = 1, aes(group = sex, color= sex), geom = "line", fun.min = 'sd', fun.max = 'sd') +
stat_summary(fun.data = mean_se, aes(group = sex, color= sex), geom = "errorbar", alpha=1, width=0.05)+
scale_color_manual(values = c("#fb9a99", "#a6cee3"))+
scale_color_manual(values = c("#A6D854", "#FFD92F"))+
scale_y_continuous(breaks = seq(0, 7, by = 1))+
labs(x = "positions", y = "foraging score") + theme_classic() + facet_wrap(~ sex, ncol = 2)
Fig_LE_sex_general
......@@ -469,7 +469,7 @@ Fig_LE_sex_blineday6_general <- EFsex_blinedays +
geom_line(color="gray", alpha=0.2)+
stat_summary(fun = "mean", size = 1, aes(group = sex, color= sex), geom = "line", fun.min = 'sd', fun.max = 'sd') +
stat_summary(fun.data = mean_se, aes(group = sex, color= sex), geom = "errorbar", alpha=1, width=0.05)+
scale_color_manual(values = c("#fb9a99", "#a6cee3"))+
scale_color_manual(values = c("#A6D854", "#FFD92F"))+
scale_y_continuous(breaks = seq(0, 7, by = 1))+
labs(x = "positions", y = "foraging score") + theme_classic() + facet_wrap(~ sex, ncol = 2)
......@@ -481,7 +481,7 @@ ggsave('C:/Users/xiamen/Desktop/modified robogator/result figs/Fig_LE_sex_blined
```
## sex effect, ggarange
```{r}
Fig3 <- ggarrange(Fig_SD_sex_age_70,Fig_SD_sex_age_140,Fig_LE_sex_restriction_45,Fig_LE_sex_restriction_60,Fig_LE_sex_general,Fig_LE_sex_blineday6_general,ncol=2, nrow=3,labels=c('A','B','C','D','E','F'),common.legend=TRUE,legend="right")
Fig3 <- ggarrange(Fig_SD_sex_age_70,Fig_SD_sex_age_140,Fig_LE_sex_restriction_45,Fig_LE_sex_restriction_60,Fig_LE_sex_general,Fig_LE_sex_blineday6_general,ncol=2, nrow=3,labels=c('A','B','C','D','E','F'),common.legend=TRUE,legend="none")
Fig3
ggsave('C:/Users/xiamen/Desktop/modified robogator/result figs/Fig3.svg', plot = Fig3, device = 'svg',dpi = 300, width = 176, height = 190, units = "mm")
```
......
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