forked from sheffield-bioinformatics-core/rna-seq-in-galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
figures.R
19 lines (16 loc) · 825 Bytes
/
figures.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
library(ggplot2)
library(dplyr)
library(gridExtra)
A <- rnorm(15,mean = 5, sd = 1)
B <- rnorm(15, mean=3, sd=1)
my_pal <- c(rgb(0,159,218,maxColorValue = 255),
rgb(31,20,93,maxColorValue = 255))
p1 <- data.frame(A,B) %>%
tidyr::gather() %>%
ggplot(aes(x=key,y=value,fill=key)) + geom_boxplot(alpha=0.7,outlier.shape = NA) + geom_jitter(width=0.1) + scale_fill_manual(name="Condition",values=my_pal) + xlab("Condition") + ylab("Expression level of gene X")
ggsave(p1, file="media/de_boxplot.png")
p2 <- data.frame(A,B) %>%
tidyr::gather() %>%
ggplot(aes(x=value,fill=key)) + geom_density(alpha=0.7) + scale_fill_manual(name="Condition",values=my_pal) + xlab("Condition") + ylab("Expression level of gene X")
grid.arrange(p1,p2)
ggsave(grid.arrange(p1,p2), file="media/de_explained.png")