Skip to content

Commit

Permalink
ENH: Optimize plots for publication
Browse files Browse the repository at this point in the history
Also refactor ggsave() export to multiple formats.
  • Loading branch information
pan14001 committed Jan 26, 2017
1 parent 8301c7e commit b177297
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ z_stack/
*.csv
*.pdf
*.png
*.svg

# Log files from CellProfiler Analyst
*.log
21 changes: 13 additions & 8 deletions plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,33 @@ binwidth <- 0.025
## Bring RNAi to the front of the level list.
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 = "."),
ggplot2::ggsave, width = 8, height = 5,
units = "in"))
}

ggplot(filter(wells_all, type == "RNAi"),
aes(coloc, fill = significant)) +
geom_histogram(binwidth = binwidth) +
scale_fill_manual(values = c("grey70", "blue")) +
ggtitle("Histogram of RNAi wells with significant overlap (p-value < 5%)") +
scale_fill_manual(values = c("grey", "blue")) +
ggtitle("Histogram of wells with significant overlap (p-value < 5%)") +
xlab("% colocalization")
ggsave("rnai-hist-signif.png")
ggsave("rnai-hist-signif.pdf")
plot_save("rnai-hist-signif")

ggplot(wells_all, aes(coloc, color = type)) +
geom_freqpoly(binwidth = binwidth) +
scale_y_log10() +
facet_wrap(~ type) +
ggtitle("Histogram of all well types") +
xlab("% colocalization")
ggsave("all-hist.png")
ggsave("all-hist.pdf")
plot_save("all-hist")

ggplot(wells_all, aes(coloc, color = type)) +
geom_density() +
facet_wrap(~ type) +
ggtitle("Density plot of wells to show distribution") +
xlab("% colocalization")
ggsave("all-density.png")
ggsave("all-density.pdf")
plot_save("all-density")

0 comments on commit b177297

Please sign in to comment.