Last active
June 8, 2016 06:49
-
-
Save ginolhac/c4921283eb7526d06904e05e113fac07 to your computer and use it in GitHub Desktop.
gridExtra::marrangeGrob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("ggplot2") | |
library("dplyr", warn.conflicts = FALSE) | |
library("gridExtra") | |
plot_id <- function(df, df2, type) { | |
df %>% | |
filter(`2^-ddCt` > 2, id == type) %>% | |
mutate(analysis = "HKgenorm:arith") %>% | |
ggplot(aes(x = ID, y = log2(`2^-ddCt`), colour = analysis))+ | |
geom_pointrange(aes(ymin = log2(`2^-ddCt.min`), ymax = log2(`2^-ddCt.max`)), | |
alpha = 0.7)+ | |
geom_point(data = filter(df2, id == type, `2^-ddCt` > 2), alpha = 0.7)+ | |
coord_flip()+ | |
scale_color_manual(name = type, values = c("purple", "red"))+ | |
theme_bw(14)+ | |
theme(axis.text.y = element_text(size = 5))+ | |
xlab(NULL) | |
} | |
# plots on multiple pages | |
Plots <- lapply(unique(res$id), function(x) plot_id(res, old_res, x)) | |
myPlots <- do.call(marrangeGrob, list(grobs=Plots, nrow = 1, ncol = 1)) | |
ggsave("global_genorm.pdf", myPlots, height = 11.69, width = 8.27) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment