draw_boxplot | R Documentation |
draw boxplot for expression
draw_boxplot(
exp,
group_list,
method = "kruskal.test",
sort = TRUE,
drop = FALSE,
width = 0.5,
pvalue_cutoff = 0.05,
xlab = "Gene",
ylab = "Expression",
grouplab = "Group",
p.label = FALSE,
add_error_bar = FALSE,
color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#66C2A5", "#FC8D62", "#8DA0CB",
"#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"),
...
)
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
method |
one of kruskal.test,aov,t.test and wilcox.test |
sort |
whether the boxplot will be sorted |
drop |
whether to discard insignificant values |
width |
width of boxplot and error bar |
pvalue_cutoff |
if drop = TRUE,genes with p-values below the threshold will be drawn |
xlab |
title of the x axis |
ylab |
title of the y axis |
grouplab |
title of group legend |
p.label |
whether to show p value in the plot |
add_error_bar |
whether to add error bar |
color |
color vector |
... |
other parameters from stat_compare_means |
a boxplot according to exp
and grouped by group
.
Xiaojie Sun
draw_heatmap
;draw_volcano
;draw_venn
if(requireNamespace("tidyr",quietly = TRUE)&
requireNamespace("ggpubr",quietly = TRUE)){
draw_boxplot(t(iris[,1:4]),iris$Species)
exp <- matrix(rnorm(60),nrow = 10)
colnames(exp) <- paste0("sample",1:6)
rownames(exp) <- paste0("gene",1:10)
exp[,4:6] = exp[,4:6] +10
exp[1:4,1:4]
group_list <- factor(rep(c("A","B"),each = 3))
draw_boxplot(exp,group_list)
draw_boxplot(exp,group_list,color = c("grey","red"))
}else{
if(!requireNamespace("ggpubr",quietly = TRUE)) {
warning("Package 'ggpubr' needed for this function to work.
Please install it by install.packages('ggpubr')")
}
if(!requireNamespace("tidyr",quietly = TRUE)) {
warning("Package 'tidyr' needed for this function to work.
Please install it by install.packages('tidyr')")
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.