diff --git a/plots.R b/plots.R index 2635491..bcda9ba 100644 --- a/plots.R +++ b/plots.R @@ -13,8 +13,9 @@ wells_all$type <- relevel(wells_all$type, "RNAi") theme_set(theme_bw()) -plot_save <- function(prefix, extensions = c("png", "pdf", "svg")) { - invisible(sapply(paste(prefix, extensions, sep = "."), +plot_save <- function(prefix, dir = "plots", + extensions = c("png", "pdf", "svg")) { + invisible(sapply(file.path(dir, paste(prefix, extensions, sep = ".")), ggplot2::ggsave, width = 8, height = 5, units = "in")) } @@ -23,10 +24,21 @@ ggplot(filter(wells_all, type == "RNAi"), aes(coloc, fill = significant)) + geom_histogram(binwidth = binwidth) + scale_fill_manual(values = c("grey", "blue")) + - ggtitle("Histogram of wells with significant overlap (p-value < 5%)") + + ggtitle("Histogram of RNAi wells with significant overlap (p-value < 5%)") + xlab("% colocalization") plot_save("rnai-hist-signif") +ggplot(filter(wells_all, + !is.na(control), + plate == "160415_015529-V"), + aes(coloc, fill = significant)) + + geom_histogram(binwidth = binwidth) + + facet_wrap(~ control) + + scale_fill_manual(values = c("grey", "blue")) + + ggtitle(paste("Histogram of control wells with", + "significant overlap (p-value < 5%)")) + + xlab("% colocalization") + ggplot(wells_all, aes(coloc, color = type)) + geom_freqpoly(binwidth = binwidth) + scale_y_log10() +