From 44bc2623e29905fbe8345f22832591b2bdba7df2 Mon Sep 17 00:00:00 2001 From: Francesco Sabatini <francesco.sabatini@idiv.de> Date: Thu, 12 Nov 2020 11:18:11 +0100 Subject: [PATCH] Minor changes to figures --- 03_Figures_Simulations.R | 53 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/03_Figures_Simulations.R b/03_Figures_Simulations.R index 0502cd5..ba103fa 100644 --- a/03_Figures_Simulations.R +++ b/03_Figures_Simulations.R @@ -98,7 +98,7 @@ ggplot(data=outp.summary %>% facet_grid(corr~inter) + theme_bw() + scale_x_continuous(name="Effect of factor e1 -> trait t1") + - scale_y_continuous(name="Prop. of significant tests") + + scale_y_continuous(name="Prop. of significant r(XY)") + theme(panel.grid = element_blank()) ggsave(filename="_pics/R1/Fig2_CorrInte_02March.png", width=6, height=5, device="png", dpi = 300, last_plot()) @@ -170,7 +170,7 @@ fig3 <- ggplot(data=outp.summary2) + geom_line(aes(x=main, y=power, group=trait, col=trait.col, lty=linetype)) + guides(linetype = FALSE) + scale_x_continuous(name="Effect of factor e1 -> trait t1", n.breaks = 4) + - scale_y_continuous(name="Prop. of significant tests") + + scale_y_continuous(name="Prop. of significant r(XY)") + facet_grid(sel.ntraits.lab~ntraits.lab) + scale_color_identity(guide = "legend", labels= hugepalette$trait) + @@ -240,7 +240,7 @@ ggplot(data=outp.summary %>% facet_grid(corr~inter) + theme_bw() + scale_x_continuous(name="Effect of factor e1 -> trait t1") + - scale_y_continuous(name="Prop. of significant tests") + + scale_y_continuous(name="Prop. of significant r(XY)") + theme(panel.grid = element_blank()) ggsave(filename="_pics/R1/FigS4_Extra_CorrInte_08Jul20.png", width=6, height=5, device="png", dpi = 300, last_plot()) @@ -285,7 +285,7 @@ ggplot(data=outp.summary %>% facet_grid(corr~inter) + theme_bw() + scale_x_continuous(name="Effect of factor e1 -> trait t1") + - scale_y_continuous(name="Prop. of significant tests") + + scale_y_continuous(name="Prop. of significant r(XW)") + theme(panel.grid = element_blank()) ggsave(filename="_pics/R1/FigSXXX_CorrInte_30November_XW.png", width=6, height=5, device="png", dpi = 300, last_plot()) @@ -332,7 +332,50 @@ ggplot(data=outp.summary %>% scale_y_continuous(name="Prop. of significant tests") + theme(panel.grid = element_blank()) -ggsave(filename="_pics/R1/FigSXXX_CorrInte_30November_SbM.png", width=6, height=5, device="png", dpi = 300, last_plot()) +ggsave(filename="_pics/R1/FigSXXY_CorrInte_30November_SbM.png", width=6, height=5, device="png", dpi = 300, last_plot()) + + +#### FIGURE SXXO - XE #### +mypath <- "_data/Experiment_02Mar2020_FactorInteraction&TraitCorr" +myfiles <- list.files(path=mypath, pattern = "Summary.txt", recursive = T) +outp.summary <- FormatData(myfiles) + +mypalette <- palette(c("#e41a1c", #1 - red) + "#ff7f00", #12 - orange + "#984ea3", #13 - violet + "##ffed6f", #2 - yellow + "#4daf4a", #23 - green + "#377eb8")) #3 - blue + +ggplot(data=outp.summary %>% + mutate(main=main/100) %>% + mutate(corr=factor(corr/10, levels=c(0, 0.4, 0.8), labels=paste0("Correlation = ", c(0, 0.4, 0.8)))) %>% + mutate(inter=factor(inter/10, levels=c(0, 0.3, 0.5), labels=paste0("Interaction = ", c(0, 0.3, 0.5)))) %>% + ungroup() %>% + dplyr::filter(stat.type=="XE") %>% + dplyr::filter(envir==1) %>% + dplyr::filter(trait %in% c("1", "2", "1 2", "3", "1 3", "2 3")) %>% + mutate(trait=factor(trait, levels=c("1", "2", "3", "1 2", "1 3", "2 3"), + labels=c("t1", "t2", "tn", "t1 t2", "t1 tn", "t2 tn"))) %>% + mutate(linetype=as.factor(ifelse(grepl(pattern="tn", x = trait), 2, 1)))) + + geom_line(aes(x=main, y=power, group=trait, col=trait, lty=linetype)) + + guides(linetype = FALSE) + + scale_color_manual("Trait\ncomb.", + values=c("#e41a1c", #1 - red) + "#e6ab02", #2 - yellow + "#377eb8", #3 - blue + "#d95f02", #12 - orange + "#984ea3", #13 - violet + "#4daf4a" #23 - green + ) + ) + + facet_grid(corr~inter) + + theme_bw() + + scale_x_continuous(name="Effect of factor e1 -> trait t1") + + scale_y_continuous(name="Prop. of significant r(XE)") + + theme(panel.grid = element_blank()) + +ggsave(filename="_pics/R1/FigSXXO_CorrInte_02March_XE.png", width=6, height=5, device="png", dpi = 300, last_plot()) -- GitLab