knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library("tidyverse") library("cowplot") #library("car") #library("SchulzLabTools")
tecc <- readRDS(file = paste0(getwd(), "/data/tecc.rds")) tevc <- readRDS(file = paste0(getwd(), "/data/tevc.rds")) a <- readRDS(file = paste0(getwd(), "/data/a.rds")) htk <- readRDS(file = paste0(getwd(), "/data/htk.rds")) htk.ls <- readRDS(file = paste0(getwd(), "/data/htk.ls.rds"))
ggplot(tecc[tecc$`Time Exposed` == 0, ], aes(x = `Input Resistance`, y = r1))+ geom_abline(intercept = 0, slope = 1, linetype = "dotted")+ geom_point(aes(color = Treatment))+ geom_smooth(method = lm, se = FALSE, linetype = "dashed")+ labs(x = "Input Resistance", y = "Membrane Resistance")+ theme(legend.position = "bottom")+ xlim(0,20)+ ylim(0,20)+ geom_text(x = 10, y = 1, label = lm_eqn(m = lm(r1 ~ `Input Resistance`, data = tecc[tecc$`Time Exposed` == 0, ]) ), parse = TRUE)+ labs(title = "Membrane Resistance vs Input Resistance: All Data") cowplot::ggsave("val.r1vr11.all.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.3, height = 6.2, dpi = 300, limitsize = TRUE) ggplot(tecc[tecc$`Time Exposed` == 0 & tecc$`Input Resistance` < 13, ], aes(x = `Input Resistance`, y = r1))+ geom_abline(intercept = 0, slope = 1, linetype = "dotted")+ geom_point(aes(color = Treatment))+ geom_smooth(method = lm, se = FALSE, linetype = "dashed")+ labs(x = "Input Resistance", y = "Membrane Resistance")+ theme(legend.position = "bottom")+ xlim(0,20)+ ylim(0,20)+ geom_text(x = 10, y = 1, label = lm_eqn(m = lm(r1 ~ `Input Resistance`, data = tecc[tecc$`Time Exposed` == 0 & tecc$`Input Resistance` < 13, ]) ), parse = TRUE)+ labs(title = "Membrane Resistance vs Input Resistance \nOutlier Removed") cowplot::ggsave("val.r1vr11.most.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.3, height = 6.2, dpi = 300, limitsize = TRUE)
ggplot(tecc[tecc$`Time Exposed` == 0, ], aes(x = Condition, y = `Input Resistance`, fill = Condition))+ geom_boxplot()+ geom_point()+ theme(axis.text.x = element_text(angle = 45, hjust = 1))+ theme(legend.position = "")+ labs(title = "Input Resistance By Group") cowplot::ggsave("val.r11.box.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.5, height = 6, dpi = 300, limitsize = TRUE) ggplot(tecc[tecc$`Time Exposed` == 0, ], aes(x = `Input Resistance`, fill = Condition))+ geom_histogram(bins = 17)+ labs(title = "Input Resistance is Unimodal") cowplot::ggsave("val.r11.hist.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 4.85, dpi = 300, limitsize = TRUE)
Membrane resistance across conditions
ggplot(tecc[tecc$`Time Exposed` == 0 & tecc$r1 > 0, ], aes(x = Condition, y = r1, fill = Condition))+ geom_boxplot()+ geom_point()+ theme(axis.text.x = element_text(angle = 45, hjust = 1))+ theme(legend.position = "")+ labs(title = "Membrane Resistance By Group") cowplot::ggsave("val.r1.box.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.5, height = 6, dpi = 300, limitsize = TRUE)
ggplot(tecc[tecc$`Time Exposed` == 0, ], aes(x = Condition, y = r12, fill = Condition))+ geom_boxplot()+ geom_point()+ theme(axis.text.x = element_text(angle = 45, hjust = 1))+ theme(legend.position = "")+ labs(title = "Transfer Resistance By Group") cowplot::ggsave("val.r12.box.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.5, height = 6, dpi = 300, limitsize = TRUE)
ggplot(tecc[tecc$`Time Exposed` == 0, ], aes(x = Condition, y = `Coupling Coefficient`, fill = Condition))+ geom_boxplot()+ geom_point()+ theme(axis.text.x = element_text(angle = 45, hjust = 1))+ theme(legend.position = "")+ labs(title = "Coupling Coefficient By Group") cowplot::ggsave("val.cc.box.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.5, height = 6, dpi = 300, limitsize = TRUE)
ggplot(tecc[tecc$`Time Exposed` == 0 & tecc$rc>0, ], aes(x = Condition, y = rc, fill = Condition))+ geom_boxplot()+ geom_point()+ theme(axis.text.x = element_text(angle = 45, hjust = 1))+ theme(legend.position = "")+ labs(title = "Coupling Resistance By Group") cowplot::ggsave("val.rc.box.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.5, height = 6, dpi = 300, limitsize = TRUE)
rect <- tecc[tecc$`Time Exposed` == 0,c("Experiment", "Inj_Cell", "Condition", "r11","r12","r1","rc","Coupling Coefficient")] inj.lc5 <- rect[rect$Inj_Cell == "LC5",] inj.lc4 <- rect[rect$Inj_Cell == "LC4",] names(inj.lc5) <- c("Experiment","Inj_Cell","Condition", "LC5.r11","LC5->LC4.r12","LC5.r1", "LC5->LC4.rc","LC5->LC4.Coupling Coefficient") names(inj.lc4) <- c("Experiment","Inj_Cell","Condition", "LC4.r11","LC4->LC5.r12","LC4.r1", "LC4->LC5.rc","LC4->LC5.Coupling Coefficient") rect <- cbind(inj.lc4, inj.lc5) # [1] "Experiment" "Inj_Cell" # [3] "Condition" "LC4.r11" # [5] "LC4->LC5.r12" "LC4.r1" # [7] "LC4->LC5.rc" "LC4->LC5.Coupling Coefficient" # [9] "LC5.r11" "LC5->LC4.r12" #[11] "LC5.r1" "LC5->LC4.rc" #[13] "LC5->LC4.Coupling Coefficient"
ggplot(rect, aes(x = LC4.r11, y = LC5.r11))+ geom_point(aes(color = Condition))+ geom_abline(slope = 1, intercept = 0, linetype = 2)+ geom_smooth(method = lm)+ ylim(0,8)+ xlim(0,8)+ geom_text(x = 4, y = 0, label = lm_eqn(m = lm(LC5.r11 ~ LC4.r11, data = rect) ), parse = TRUE)+ labs(title = "LC5 Input Resistance by LC4 Input Resistance")+ theme(legend.position = "") cowplot::ggsave("val.r11.lc5vlc4.dir.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 5.86, dpi = 300, limitsize = TRUE)
ggplot(rect, aes(x = LC4.r1, y = LC5.r1))+ geom_point(aes(color = Condition))+ geom_abline(slope = 1, intercept = 0, linetype = 2)+ geom_smooth(method = lm)+ ylim(0,15)+ xlim(0,15)+ geom_text(x = 7.5, y = 0, label = lm_eqn(m = lm(LC5.r1 ~ LC4.r1, data = rect) ), parse = TRUE)+ labs(title = "LC5 Membrane Resistance by LC4 Membrane Resistance")+ theme(legend.position = "") cowplot::ggsave("val.r1.lc5vlc4.dir.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 5.86, dpi = 300, limitsize = TRUE)
ggplot(rect, aes(x = `LC4->LC5.r12`, y = `LC5->LC4.r12`))+ geom_point(aes(color = Condition))+ geom_abline(slope = 1, intercept = 0, linetype = 2)+ geom_smooth(method = lm)+ ylim(0,7)+ xlim(0,7)+ geom_text(x = 3.5, y = 0, label = lm_eqn(m = lm(`LC5->LC4.r12`~`LC4->LC5.r12`, data = rect) ), parse = TRUE)+ labs(title = "LC4->LC5 Transfer Resistance by \nLC5->LC4 Transfer Resistance")+ theme(legend.position = "") cowplot::ggsave("val.r12.lc5vlc4.dir.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 5.86, dpi = 300, limitsize = TRUE)
ggplot(rect, aes(x = `LC4->LC5.rc`, y = `LC5->LC4.rc`))+ geom_point(aes(color = Condition))+ geom_abline(slope = 1, intercept = 0, linetype = 2)+ geom_smooth(method = lm)+ ylim(0,11)+ xlim(0,11)+ geom_text(x = 5.5, y = 0, label = lm_eqn(m = lm(`LC5->LC4.rc`~`LC4->LC5.rc`, data = rect) ), parse = TRUE)+ labs(title = "LC4->LC5 Coupling Resistance by \nLC5->LC4 Coupling Resistance")+ theme(legend.position = "") cowplot::ggsave("val.rc.lc5vlc4.dir.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 5.86, dpi = 300, limitsize = TRUE)
ggplot(rect, aes(x = `LC4->LC5.Coupling Coefficient`, y = `LC5->LC4.Coupling Coefficient`))+ geom_point(aes(color = Condition))+ geom_abline(slope = 1, intercept = 0, linetype = 2)+ geom_smooth(method = lm)+ ylim(0,1)+ xlim(0,1)+ geom_text(x = 0.5, y = 0, label = lm_eqn(m = lm(`LC5->LC4.Coupling Coefficient`~`LC4->LC5.Coupling Coefficient`, data = rect) ), parse = TRUE)+ labs(title = "LC4->LC5 Coupling Coefficient \nby LC5->LC4 Coupling Coefficient")+ theme(legend.position = "") cowplot::ggsave("val.cc.lc5vlc4.dir.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 5.86, dpi = 300, limitsize = TRUE)
merge_htk_methods <- function(input.df = htk.peak, input.df.ls = htk.ls.peak){ #input.df = htk.peak #input.df.ls = htk.ls.peak input.df <- input.df[, !(names(input.df) %in% c("Recording"))] input.df.ls <- input.df.ls[, !(names(input.df.ls) %in% c("Recording"))] #input.df$online <- FALSE #input.df.ls$online <- TRUE input.df$Experiment <- as.character(input.df$Experiment) input.df$IN4 <- as.character(input.df$IN4) input.df$IN9 <- as.character(input.df$IN9) input.df$target.mV <- ((round((input.df$mV)/10))*10) input.df.ls$target.mV <- ((round((input.df.ls$mV)/10))*10) input.df <- input.df %>% rename(manual.nA = "nA") input.df <- input.df %>% rename(manual.mV = "mV") input.df.ls <- input.df.ls %>% rename(online.mV = "mV") input.df.ls <- input.df.ls %>% rename(online.nA = "nA") #dplyr::full_join(input.df, input.df.ls) %>% head() #full_join(input.df, input.df.ls, by = c("Experiment", "Time Exposed", "Cell", "target.mV")) %>% head() return(dplyr::full_join(input.df, input.df.ls)) } htk.comparison <- merge_htk_methods(input.df = htk.peak, input.df.ls = htk.ls.peak)
ggplot(htk.comparison, aes(x = manual.mV, y = online.mV))+ geom_abline(slope = 1, intercept = 0, linetype = "dashed")+ geom_point(aes(color = interact), alpha = 0.4)+ geom_smooth(method = lm)+ geom_text(x = -30, y = -80, label = lm_eqn(m = lm(`online.mV`~`manual.mV`, data = htk.comparison)), parse = TRUE)+ theme(legend.position = "")+ ylim(-80,20)+ xlim(-80,20)+ labs(title = "No Systematic Difference in Voltage Control") cowplot::ggsave("val.man.pn.htk.mv.peak.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 5.86, dpi = 300, limitsize = TRUE) ggplot(htk.comparison, aes(x = manual.nA, y = online.nA))+ geom_abline(slope = 1, intercept = 0, linetype = "dashed")+ geom_point(aes(color = interact), alpha = 0.4)+ geom_smooth(method = lm)+ geom_text(x = 225, y = 0, label = lm_eqn(m = lm(`online.nA`~`manual.nA`, data = htk.comparison)), parse = TRUE)+ ylim(0,450)+ xlim(0,450)+ theme(legend.position = "")+ labs(title = "Measures of HTK Transient Differ Based on \nLeak Subtraction Method") cowplot::ggsave("val.man.pn.htk.na.peak.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 5.86, dpi = 300, limitsize = TRUE)
voltages <- c(-80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20) compare.htk.methods <- list() for (i in 1:length(voltages)){ compare.htk.methods[[i]] <- ggplot(htk.comparison[htk.comparison$target.mV == voltages[i], ], aes(x = manual.nA, y = online.nA))+ geom_abline(slope = 1, intercept = 0, linetype = "dashed")+ geom_point(aes(color = interact))+ geom_smooth(method = lm, color = "red")+ labs(title = paste("At", as.character(voltages[i]), "mV"))+ theme(legend.position = "") } cowplot::plot_grid(plotlist = compare.htk.methods) cowplot::ggsave("val.man.pn.htk.multi.peak.mv.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.72, height = 6.23, dpi = 300, limitsize = TRUE)
htk.comparison[,"nA.diff"] <- (htk.comparison[,"online.nA"] - htk.comparison[,"manual.nA"]) lower.sd <- (mean(na.omit(htk.comparison$nA.diff)) - sd(na.omit(htk.comparison$nA.diff))) upper.sd <- (mean(na.omit(htk.comparison$nA.diff)) + sd(na.omit(htk.comparison$nA.diff))) q1 <- as.numeric(summary(htk.comparison$nA.diff)[2]) q2 <- as.numeric(summary(htk.comparison$nA.diff)[3]) q3 <- as.numeric(summary(htk.comparison$nA.diff)[5]) htk.comparison$target.mV <- as.factor(htk.comparison$target.mV) ggplot(htk.comparison, aes(x = nA.diff, fill = target.mV))+ geom_histogram(bins = 100)+ geom_segment(aes(x = lower.sd, y = -15, xend = upper.sd, yend = -15), color = "red", size = 1 )+ geom_segment(aes(x = mean(na.omit(htk.comparison$nA.diff)), y = -10, xend = mean(na.omit(htk.comparison$nA.diff)), yend = -20), color = "red", size = 1 )+ geom_segment(aes(x = q1, y = -5, xend = q3, yend = -5), color = "blue", size = 1 )+ geom_segment(aes(x = q2, y = 0, xend = q2, yend = -10), color = "blue", size = 1)+ labs(title = "Online less Offline nA: \nQuartiles Denoted in Blue \nStandard Deviation in Red")+ theme(legend.position = "right") cowplot::ggsave("val.man.pn.htk.hist.peak.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 5.86, dpi = 300, limitsize = TRUE)
htk.comparison <- merge_htk_methods(input.df = htk.end, input.df.ls = htk.ls.end)
ggplot(htk.comparison, aes(x = manual.mV, y = online.mV))+ geom_abline(slope = 1, intercept = 0, linetype = "dashed")+ geom_point(aes(color = interact), alpha = 0.4)+ geom_smooth(method = lm)+ theme(legend.position = "")+ ylim(-80,20)+ xlim(-80,20)+ labs(title = "No Systematic Difference in Voltage Control")+ geom_text(x = -30, y = -75, label = lm_eqn(m = lm(`online.mV`~`manual.mV`, data = htk.comparison)), parse = TRUE) cowplot::ggsave("val.man.pn.htk.mv.end.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 5.86, dpi = 300, limitsize = TRUE) ggplot(htk.comparison, aes(x = manual.nA, y = online.nA))+ geom_abline(slope = 1, intercept = 0, linetype = "dashed")+ geom_point(aes(color = interact), alpha = 0.4)+ geom_smooth(method = lm)+ ylim(0,450)+ xlim(0,450)+ theme(legend.position = "")+ labs(title = "Measures of HTK Transient Differ Based on \nLeak Subtraction Method")+ geom_text(x = 225, y = 0, label = lm_eqn(m = lm(`online.nA`~`manual.nA`, data = htk.comparison)), parse = TRUE) cowplot::ggsave("val.man.pn.htk.na.end.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 5.86, dpi = 300, limitsize = TRUE)
voltages <- c(-80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20) compare.htk.methods <- list() for (i in 1:length(voltages)){ compare.htk.methods[[i]] <- ggplot(htk.comparison[htk.comparison$target.mV == voltages[i], ], aes(x = manual.nA, y = online.nA))+ geom_abline(slope = 1, intercept = 0, linetype = "dashed")+ geom_point(aes(color = interact))+ geom_smooth(method = lm, color = "red")+ labs(title = paste("At", as.character(voltages[i]), "mV"))+ theme(legend.position = "") } cowplot::plot_grid(plotlist = compare.htk.methods) cowplot::ggsave("val.man.pn.htk.multi.end.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.72, height = 6.23, dpi = 300, limitsize = TRUE)
htk.comparison[,"nA.diff"] <- (htk.comparison[,"online.nA"] - htk.comparison[,"manual.nA"]) lower.sd <- (mean(na.omit(htk.comparison$nA.diff)) - sd(na.omit(htk.comparison$nA.diff))) upper.sd <- (mean(na.omit(htk.comparison$nA.diff)) + sd(na.omit(htk.comparison$nA.diff))) q1 <- as.numeric(summary(htk.comparison$nA.diff)[2]) q2 <- as.numeric(summary(htk.comparison$nA.diff)[3]) q3 <- as.numeric(summary(htk.comparison$nA.diff)[5]) htk.comparison$target.mV <- as.factor(htk.comparison$target.mV) ggplot(htk.comparison, aes(x = nA.diff, fill = target.mV))+ geom_histogram(bins = 100)+ geom_segment(aes(x = lower.sd, y = -15, xend = upper.sd, yend = -15), color = "red", size = 1 )+ geom_segment(aes(x = mean(na.omit(htk.comparison$nA.diff)), y = -10, xend = mean(na.omit(htk.comparison$nA.diff)), yend = -20), color = "red", size = 1 )+ geom_segment(aes(x = q1, y = -5, xend = q3, yend = -5), color = "blue", size = 1 )+ geom_segment(aes(x = q2, y = 0, xend = q2, yend = -10), color = "blue", size = 1)+ labs(title = "Online less Offline nA: \nQuartiles Denoted in Blue \nStandard Deviation in Red")+ theme(legend.position = "right") cowplot::ggsave("val.man.pn.htk.hist.end.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 6.44, height = 5.86, dpi = 300, limitsize = TRUE)
TREATMENT <- "Phase Shift" return.plts <- list() # Un-normalized --------------------------------------------------------------- return.plts[[1]] <- ggplot(tecc[tecc$Treatment == TREATMENT & tecc$`Time Exposed` < 90, ], aes( x = `Time Exposed`, y = (rc), color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "rc", title = paste(TREATMENT, "Coupling Resistance") ) + theme_Publication()+ facet_grid(~Condition) return.plts[[2]] <- ggplot(tecc[tecc$Treatment == TREATMENT & tecc$`Time Exposed` < 90, ], aes( x = `Time Exposed`, y = `Coupling Coefficient`, color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "CC", title = paste(TREATMENT, "Coupling Coefficient") ) + theme_Publication()+ facet_grid(~Condition) return.plts[[3]] <- ggplot(tecc[tecc$Treatment == TREATMENT & tecc$`Time Exposed` < 90, ], aes( x = `Time Exposed`, y = `Input Resistance`, color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "Input Resistance", title = paste(TREATMENT, "Input Resistance") ) + theme_Publication()+ facet_grid(~Condition) # Normalized ------------------------------------------------------------------ return.plts[[4]] <- ggplot(tecc[tecc$Treatment == TREATMENT & tecc$`Time Exposed` < 90, ], aes( x = `Time Exposed`, y = (rc / rc.0), color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "Normalized rc", title = paste(TREATMENT, "Normalized Coupling Resistance") ) + theme_Publication()+ facet_grid(~Condition) return.plts[[5]] <- ggplot(tecc[tecc$Treatment == TREATMENT & tecc$`Time Exposed` < 90, ], aes( x = `Time Exposed`, y = `Coupling Coefficient` / `Coupling Coefficient.0`, color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "Normalized CC", title = paste(TREATMENT, "Normalized Coupling Coefficient") ) + theme_Publication()+ facet_grid(~Condition) return.plts[[6]] <- ggplot(tecc[tecc$Treatment == TREATMENT & tecc$`Time Exposed` < 90, ], aes( x = `Time Exposed`, y = `Input Resistance` / `Input Resistance.0`, color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "Normalized Input Resistance", title = paste(TREATMENT, "Normalized Input Resistance") ) + theme_Publication()+ facet_grid(~Condition) # Group interaction style plots ----------------------------------------------- return.plts[[7]] <- ggplot(tecc[tecc$Treatment == TREATMENT & tecc$`Time Exposed` < 90, ], aes( x = `Time Exposed`, y = `Coupling Coefficient` / `Coupling Coefficient.0`, color = Condition, group = Condition )) + geom_point(position = position_jitter(width = 0.1), size = 2) + stat_summary(fun.y = mean, geom = "point", pch = 12, size = 5) + stat_summary(fun.y = mean, geom = "line", size = 1) + labs(color = "Phase \nAngle") + labs(title = "Interaction of Treatment:Time \non Coupling Coefficient (normalized)", x = "Time in Minutes", y = "Coupling Coefficient") + theme_Publication() + ylim(0, 2) return.plts[[8]] <- ggplot(tecc[tecc$Treatment == TREATMENT & tecc$`Time Exposed` < 90, ], aes( x = `Time Exposed`, y = `Coupling Coefficient`, color = Condition, group = interaction(Condition, `Time Exposed`) )) + geom_boxplot() + geom_point(position = position_jitter(width = 0.1), size = 2) + labs(title = "Coupling Coefficients over Time", x = "Time in Minutes", y = "Coupling Coefficient") + facet_grid(~Condition) + theme_Publication() + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + theme(legend.position = "") + ylim(0, 1) # ----------------------------------------------------------------------------- save_fig_list(input.list = return.plts, title.prefix = "phaseshift", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/"))
ggplot(tevc[tevc$Treatment == "Phase Shift" & tevc$`Time Exposed` < 90,], aes(x = `Time Exposed`, y = slopes, color = Condition, group = interaction(Experiment,Inj_Cell)))+ geom_point()+ geom_line()+ labs(y = "Ratio of post / pre-synaptic current", title = "Change Over Time in the Small Phase Angle Group")+ theme(legend.position = "")+ facet_grid(~Condition) cowplot::ggsave("phaseshift.tevc.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.86, height = 5.86, dpi = 300, limitsize = TRUE)
#show_tecc_plots(TREATMENT = "Small Phase Angle") TREATMENT <- "Small Phase Angle" return.plts <- list() # Un-normalized --------------------------------------------------------------- return.plts[[1]] <- ggplot(tecc[tecc$Treatment == TREATMENT, ], aes( x = `Time Exposed`, y = (rc), color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "rc", title = paste(TREATMENT, "Coupling Resistance") ) + theme_Publication() return.plts[[2]] <- ggplot(tecc[tecc$Treatment == TREATMENT, ], aes( x = `Time Exposed`, y = `Coupling Coefficient`, color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "CC", title = paste(TREATMENT, "Coupling Coefficient") ) + theme_Publication() return.plts[[3]] <- ggplot(tecc[tecc$Treatment == TREATMENT, ], aes( x = `Time Exposed`, y = `Input Resistance`, color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "Input Resistance", title = paste(TREATMENT, "Input Resistance") ) + theme_Publication() # Normalized ------------------------------------------------------------------ return.plts[[4]] <- ggplot(tecc[tecc$Treatment == TREATMENT, ], aes( x = `Time Exposed`, y = (rc / rc.0), color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "Normalized rc", title = paste(TREATMENT, "Normalized Coupling Resistance") ) + theme_Publication() return.plts[[5]] <- ggplot(tecc[tecc$Treatment == TREATMENT, ], aes( x = `Time Exposed`, y = `Coupling Coefficient` / `Coupling Coefficient.0`, color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "Normalized CC", title = paste(TREATMENT, "Normalized Coupling Coefficient") ) + theme_Publication() return.plts[[6]] <- ggplot(tecc[tecc$Treatment == TREATMENT, ], aes( x = `Time Exposed`, y = `Input Resistance` / `Input Resistance.0`, color = Condition, group = interact )) + geom_point() + geom_line() + geom_hline(yintercept = 1, linetype = 2) + labs( y = "Normalized Input Resistance", title = paste(TREATMENT, "Normalized Input Resistance") ) + theme_Publication() # Group interaction style plots ----------------------------------------------- return.plts[[7]] <- ggplot(tecc[tecc$Treatment == TREATMENT, ], aes( x = `Time Exposed`, y = `Coupling Coefficient` / `Coupling Coefficient.0`, color = interact, group = Condition )) + geom_point(position = position_jitter(width = 0.1), size = 2) + stat_summary(fun.y = mean, geom = "point", pch = 12, size = 5) + stat_summary(fun.y = mean, geom = "line", size = 1) + labs(color = "Phase \nAngle") + labs(title = "Interaction of Treatment:Time \non Coupling Coefficient (normalized)", x = "Time in Minutes", y = "Coupling Coefficient") + theme_Publication() + ylim(0, 2) return.plts[[8]] <- ggplot(tecc[tecc$Treatment == TREATMENT, ], aes( x = Condition, y = `Coupling Coefficient`, color = interact, group = Condition )) + geom_boxplot() + geom_point(position = position_jitter(width = 0.1), size = 2) + labs(title = "Coupling Coefficients over Time", x = "Time in Minutes", y = "Coupling Coefficient") + facet_grid(~`Time Exposed`) + theme_Publication() + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + theme(legend.position = "") + ylim(0, 1) # ----------------------------------------------------------------------------- save_fig_list(input.list = return.plts, title.prefix = "smallphase", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/"))
ggplot(tevc[tevc$Treatment == "Small Phase Angle",], aes(x = `Time Exposed`, y = slopes, color = interact, group = interaction(Experiment,Inj_Cell)))+ geom_point()+ geom_line()+ labs(y = "Ratio of post / pre-synaptic current", title = "Change Over Time in the Small Phase Angle Group") cowplot::ggsave("smallphase.tevc.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.86, height = 5.86, dpi = 300, limitsize = TRUE)
return.plts <- standard_ionic_plts(current.treatment = "Small Phase Angle", title.prefix = "A Peak", input.df = a.peak[a.peak$Treatment == "Small Phase Angle",]) save_fig_list(input.list = return.plts, title.prefix = "smallphase.a.peak", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts(current.treatment = "Small Phase Angle", title.prefix = "A End", input.df = a.end[a.end$Treatment == "Small Phase Angle",]) save_fig_list(input.list = return.plts, title.prefix = "smallphase.end.peak", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts(current.treatment = "Small Phase Angle", title.prefix = "HTK Peak", input.df = htk.peak[htk.peak$Treatment == "Small Phase Angle",]) save_fig_list(input.list = return.plts, title.prefix = "smallphase.htk.peak", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts(current.treatment = "Small Phase Angle", title.prefix = "HTK End", input.df = htk.end[htk.end$Treatment == "Small Phase Angle",]) save_fig_list(input.list = return.plts, title.prefix = "smallphase.htk.end", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/"))
inv.plts <- show_tecc_plots(TREATMENT = "Inverted Wave") save_fig_list(input.list = inv.plts, title.prefix = "inv", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/"))
ggplot(tevc[tevc$Treatment == "Inverted Wave",], aes(x = `Time Exposed`, y = slopes, color = interact, group = interaction(Experiment,Inj_Cell)))+ geom_point()+ geom_line()+ labs(y = "Ratio of post / pre-synaptic current", title = "Change Over Time in the Small Phase Angle Group") cowplot::ggsave("inv.tevc.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.86, height = 5.86, dpi = 300, limitsize = TRUE)
return.plts <- standard_ionic_plts_1c(current.treatment = "Inverted Wave", title.prefix = "A Peak", input.df = a.peak[a.peak$Treatment == "Inverted Wave",]) save_fig_list(input.list = return.plts, title.prefix = "inv.a.peak", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Inverted Wave", title.prefix = "A End", input.df = a.end[a.end$Treatment == "Inverted Wave",]) save_fig_list(input.list = return.plts, title.prefix = "inv.a.end", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Inverted Wave", title.prefix = "HTK Peak", input.df = htk.peak[htk.peak$Treatment == "Inverted Wave",]) save_fig_list(input.list = return.plts, title.prefix = "inv.htk.peak", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Inverted Wave", title.prefix = "HTK End", input.df = htk.end[htk.end$Treatment == "Inverted Wave",]) save_fig_list(input.list = return.plts, title.prefix = "inv.htk.end", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/"))
ab.plts <- show_tecc_plots(TREATMENT = "Aberrant Wave") save_fig_list(input.list = ab.plts, title.prefix = "ab", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/"))
ggplot(tevc[tevc$Treatment == "Aberrant Wave",], aes(x = `Time Exposed`, y = slopes, color = interact, group = interaction(Experiment,Inj_Cell)))+ geom_point()+ geom_line()+ labs(y = "Ratio of post / pre-synaptic current", title = "Change Over Time in the Small Phase Angle Group") cowplot::ggsave("ab.tevc.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.86, height = 5.86, dpi = 300, limitsize = TRUE)
return.plts <- standard_ionic_plts_1c(current.treatment = "Aberrant Wave", title.prefix = "A Peak", input.df = a.peak[a.peak$Treatment == "Aberrant Wave",]) save_fig_list(input.list = return.plts, title.prefix = "ab.a.peak", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Aberrant Wave", title.prefix = "A End", input.df = a.end[a.end$Treatment == "Aberrant Wave",]) save_fig_list(input.list = return.plts, title.prefix = "ab.a.end", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Aberrant Wave", title.prefix = "HTK Peak", input.df = htk.peak[htk.peak$Treatment == "Aberrant Wave",]) save_fig_list(input.list = return.plts, title.prefix = "ab.htk.peak", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Aberrant Wave", title.prefix = "HTK End", input.df = htk.end[htk.end$Treatment == "Aberrant Wave",]) save_fig_list(input.list = return.plts, title.prefix = "ab.htk.end", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/"))
sh.plts <- show_tecc_plots(TREATMENT = "Silent Control") save_fig_list(input.list = sh.plts, title.prefix = "sh", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/"))
ggplot(tevc[tevc$Treatment == "Silent Control",], aes(x = `Time Exposed`, y = slopes, color = interact, group = interaction(Experiment,Inj_Cell)))+ geom_point()+ geom_line()+ labs(y = "Ratio of post / pre-synaptic current", title = "Change Over Time in the Small Phase Angle Group") cowplot::ggsave("sh.tevc.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.86, height = 5.86, dpi = 300, limitsize = TRUE)
return.plts <- standard_ionic_plts_1c(current.treatment = "Silent Control", title.prefix = "A Peak", input.df = a.peak[a.peak$Treatment == "Silent Control",]) save_fig_list(input.list = return.plts, title.prefix = "sh.a.peak", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Silent Control", title.prefix = "A End", input.df = a.end[a.end$Treatment == "Silent Control",]) save_fig_list(input.list = return.plts, title.prefix = "sh.a.end", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Silent Control", title.prefix = "HTK Peak", input.df = htk.peak[htk.peak$Treatment == "Silent Control",]) save_fig_list(input.list = return.plts, title.prefix = "sh.htk.peak", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Silent Control", title.prefix = "HTK End", input.df = htk.end[htk.end$Treatment == "Silent Control",]) save_fig_list(input.list = return.plts, title.prefix = "sh.htk.end", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/"))
ctea.plts <- show_tecc_plots(TREATMENT = "Control Wave + TEA") save_fig_list(input.list = ctea.plts, title.prefix = "ctea", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/"))
ggplot(tevc[tevc$Treatment == "Control Wave + TEA",], aes(x = `Time Exposed`, y = slopes, color = interact, group = interaction(Experiment,Inj_Cell)))+ geom_point()+ geom_line()+ labs(y = "Ratio of post / pre-synaptic current", title = "Change Over Time in the Small Phase Angle Group") cowplot::ggsave("ctea.tevc.png", plot = ggplot2::last_plot(), device = NULL, path = paste0( use.path, "180315_act_dept_report/figures/"), scale = 1, width = 9.86, height = 5.86, dpi = 300, limitsize = TRUE)
return.plts <- standard_ionic_plts_1c(current.treatment = "Control Wave + TEA", title.prefix = "A Peak", input.df = a.peak[a.peak$Treatment == "Control Wave + TEA",]) save_fig_list(input.list = return.plts, title.prefix = "ctea.a.peak", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Control Wave + TEA", title.prefix = "A End", input.df = a.end[a.end$Treatment == "Control Wave + TEA",]) save_fig_list(input.list = return.plts, title.prefix = "ctea.a.end", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Control Wave + TEA", title.prefix = "HTK Peak", input.df = htk.peak[htk.peak$Treatment == "Control Wave + TEA",]) save_fig_list(input.list = return.plts, title.prefix = "ctea.htk.peak", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/")) return.plts <- standard_ionic_plts_1c(current.treatment = "Control Wave + TEA", title.prefix = "HTK End", input.df = htk.end[htk.end$Treatment == "Control Wave + TEA",]) save_fig_list(input.list = return.plts, title.prefix = "ctea.htk.end", file.type = ".png", save.path = paste0(use.path, "180315_act_dept_report/figures/"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.