Skip to content

Commit

Permalink
Updates to y-axis on figs 2 & 4
Browse files Browse the repository at this point in the history
  • Loading branch information
VinceFasanello committed Sep 24, 2020
1 parent acadfaa commit 7d64f84
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions 3_Analysis/Analyze.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,17 @@ mywidth <- 3.345
p <- ggplot(myres, aes(x=myx, color = myc, fill = myc)) +
geom_histogram(alpha = myfillapha, position = "identity", binwidth = mybinwidth) +
geom_rug(alpha = myptalpha)+
geom_rug(alpha = myptalpha, sides = "t")+
#xlim(c(-0.06, 0.06)) +
ylim(c(NA,15)) +
# ylim(c(NA,15)) +
geom_vline(xintercept = 0, linetype = "dashed", color = myhighlight) +
scale_color_manual(values =mypalette, guide = FALSE) +
scale_fill_manual(values =mypalette) +
theme_classic() +
theme(legend.position= c(0.8,0.8)) +
labs(fill = "Significance") +
ggtitle(mytitle)+ ylab(myylab)+ xlab(myxlab)+
geom_hline(yintercept=-0.01, colour="white", size=1.01)+
# geom_hline(yintercept=-0.01, colour="white", size=1.01)+
theme(axis.title.y = element_text(size = mytextsize, face = "bold", margin = margin(0,0,0,0, "pt")))+
theme(axis.title.x = element_text(size = mytextsize, face = "bold", margin = margin(0,0,0,0, "pt")))+
theme(axis.text.y = element_text(size = mytextsize, angle = 0))+
Expand All @@ -252,7 +252,8 @@ p <- ggplot(myres, aes(x=myx, color = myc, fill = myc)) +
theme(legend.text = element_text(size = mytextsize))+
scale_x_continuous(breaks = seq(-0.06,0.06,by=0.01),
labels = c("-0.06", "", "-0.04", "", "-0.02", "", "0", "", "0.02", "", "0.04", "", "0.06"),
limits = c(-0.06, 0.06))
limits = c(-0.06, 0.06))+
scale_y_continuous(expand = c(0,0), limits = c(0,15))
p
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -581,17 +582,17 @@ mywidth <- 3.345
p <- ggplot(myres[myres$se_deltafit < 0.029,], aes(x=myx, color = myc, fill = myc)) +
geom_histogram(alpha = myfillapha, position = "identity", binwidth = mybinwidth) +
geom_vline(xintercept = weighted.mean(myx, myr), linetype = "dashed", color = myhighlight) +
geom_vline(xintercept = weighted.mean(myx[myc == "fdr > 0.01"], myr[myc == "fdr > 0.01"]), linetype = "dashed", color = myhighlight2) +
geom_vline(xintercept = weighted.mean(myx[myc == "fdr <= 0.01"], myr[myc== "fdr <= 0.01"]), linetype = "dashed", color = myhighlight3) +
geom_rug(alpha = myptalpha)+
geom_vline(xintercept = weighted.mean(myx, myr), linetype = "dashed", color = "black") +
geom_vline(xintercept = weighted.mean(myx[myc == "fdr > 0.01"], myr[myc == "fdr > 0.01"]), linetype = "dashed", color = "#28bd90") +
geom_vline(xintercept = weighted.mean(myx[myc == "fdr <= 0.01"], myr[myc== "fdr <= 0.01"]), linetype = "dashed", color = "#6e3001") +
geom_rug(alpha = myptalpha, sides = "t")+
scale_color_manual(values =mypalette, guide = FALSE) +
scale_fill_manual(values =mypalette) +
theme_classic() +
theme(legend.position= c(0.8,0.8)) +
labs(fill = "Significance") +
ggtitle(mytitle)+ ylab(myylab)+ xlab(myxlab) +
geom_hline(yintercept=0.01, colour="white", size=1.01)+
# geom_hline(yintercept=0.01, colour="white", size=1.01)+
theme(axis.title.y = element_text(size = mytextsize, face = "bold", margin = margin(0,0,0,0, "pt")))+
theme(axis.title.x = element_text(size = mytextsize, face = "bold", margin = margin(0,0,0,0, "pt")))+
theme(axis.text.y = element_text(size = mytextsize, angle = 0))+
Expand All @@ -601,7 +602,8 @@ p <- ggplot(myres[myres$se_deltafit < 0.029,], aes(x=myx, color = myc, fill = my
scale_x_continuous(breaks = seq(-0.1,0.25,by=0.05),
labels = c("-0.1", "-0.05", "0", "0.05", "0.1", "0.15", "0.2", "0.25"),
limits = c(-0.05, 0.25))+
scale_y_continuous(breaks = seq(0,25,by=5),
scale_y_continuous(expand = c(0,0),
breaks = seq(0,25,by=5),
limits = c(0,25))
p
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -1450,7 +1452,7 @@ myptalpha <- 0.35
mylinealpha <- 0.35
mypalette <- setpalette
mytextsize <- 8
mytextsize <- 6
myheight <- 3.345
mywidth <- 6.69
myptsize <- ((((myr/max(myr))*10)*((myheight*mywidth)/(7^2))) - min(((myr/max(myr))*10)*((myheight*mywidth)/(7^2))))+1
Expand All @@ -1465,20 +1467,20 @@ p <- ggplot(my, aes(x=myx, y=myy, weight = myr, color = myc)) +
geom_segment(x=2.90, xend=3.10, y = weighted.mean(myy[myx == "CM+Saltdiploid0.001"], myr[myx == "CM+Saltdiploid0.001"]), yend = weighted.mean(myy[myx == "CM+Saltdiploid0.001"], myr[myx == "CM+Saltdiploid0.001"]), color = myoutline) +
geom_segment(x=1.90, xend=2.10, y = weighted.mean(myy[myx == "CM+Ethanoldiploid0.001"], myr[myx == "CM+Ethanoldiploid0.001"]), yend = weighted.mean(myy[myx == "CM+Ethanoldiploid0.001"], myr[myx == "CM+Ethanoldiploid0.001"]), color = myoutline) +
geom_segment(x=0.90, xend=1.10, y = weighted.mean(myy[myx == "CMdiploid0.001"], myr[myx == "CMdiploid0.001"]), yend = weighted.mean(myy[myx == "CMdiploid0.001"], myr[myx == "CMdiploid0.001"]), color = myoutline) +
geom_rug(sides = "b" , position = position_nudge(x=-0.75), alpha = myptalpha)+
geom_rug(sides = "l" , position = position_nudge(x=-0.75), alpha = myptalpha)+
scale_color_manual(values =mypalette) +
geom_hline(yintercept = 0, lty = "dotted") +
coord_flip() +
theme_classic()+
theme(legend.position="none") +
ggtitle(mytitle) + ylab(myylab) + xlab(myxlab)+
scale_x_discrete(labels = c("CM \n Diploid \n 1:1000", "CM+EtOH \n Diploid \n 1:1000", "CM+NaCl \n Diploid \n 1:1000", "CM \n Diploid \n 1:4000", "CM \n Diploid \n 1:250", "CM \n Haploid \n 1:1000")) +
scale_x_discrete(labels = c("CM\nDiploid\n1:1000\n(Control)", "CM+EtOH\nDiploid\n1:1000", "CM+NaCl\nDiploid\n1:1000", "CM\nDiploid\n1:4000", "CM\nDiploid\n1:250", "CM\nHaploid\n 1:1000")) +
scale_y_continuous(breaks = seq(-.05,.25,by=.05),
labels = c("-0.05", "0", "0.05", "0.1", "0.15", "0.2", "0.25"),
limits = c(-.05, .25))+
theme(axis.title.y = element_text(size = 8, face = "bold", margin = margin(0,0,0,0, "pt")))+
theme(axis.title.x = element_text(size = 8, face = "bold", margin = margin(0,0,0,0, "pt")))+
theme(axis.text.y = element_text(size = 8, angle = 0))+
theme(axis.text.y = element_text(size = 6, angle = 0))+
theme(axis.text.x = element_text(size = 8, angle = 0))+
annotate("text", x=c(2,3,4,5,6), y=c(.065,.25,.045,.095,.115), label = c("**", "***", "", "***", "*"), size = 8, fontface = "bold")
Expand Down

0 comments on commit 7d64f84

Please sign in to comment.