Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
xjsun1221 committed Jan 25, 2021
1 parent f4d1f10 commit d3db5e0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: tinyarray
Type: Package
Title: simplify geo and tcga analysis and plots
Version: 1.7.3
Version: 1.7.4
Author: Xiaojie Sun
Maintainer: Xiaojie Sun <18763899370@163.com>
Description: Simplify geo and tcga analysis and plots
Expand Down
11 changes: 7 additions & 4 deletions R/plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ draw_venn <- function(x,name){
##' @param ylab title of the y axis
##' @param grouplab title of group legend
##' @param p.label whether to show p vlaue in the plot
##' @param add_error_bar whether to add error bar
##' @param colset color for boxplot
##' @return a boxplot according to \code{exp} and grouped by \code{group}.
##' @author Xiaojie Sun
##' @importFrom tidyr gather
Expand Down Expand Up @@ -298,7 +300,10 @@ draw_boxplot = function(exp,group_list,
xlab = "Gene",
ylab = "Expression",
grouplab = "Group",
p.label = F){
p.label = F,
add_error_bar = F,
colset = c("#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854",
"#FFD92F", "#E5C494", "#B3B3B3")){
p0 <- all(apply(exp,2,is.numeric)) & (!is.null(rownames(exp)))
if(!p0) stop("exp must be a numeric matrix with rownames")
p1 = method %in% c("kruskal.test","aov","t.test","wilcox.test")
Expand Down Expand Up @@ -344,18 +349,16 @@ draw_boxplot = function(exp,group_list,
levels = names(sort(x)),
ordered = T)
}
colset = c("#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854",
"#FFD92F", "#E5C494", "#B3B3B3")
col = colset[1:length(levels(group_list))]
p = ggplot(dat,aes(rows,exp,fill = group))+
stat_boxplot(geom ='errorbar', width = width)+
geom_boxplot( width = width)+
theme_bw()+
theme(legend.position = "top")+
labs(fill = grouplab,
x = xlab,
y = ylab)+
scale_fill_manual(values = col)
if(add_error_bar) p = stat_boxplot(geom ='errorbar', width = width)
if(!p.label){
p = p + stat_compare_means(aes(group = group,label = ..p.signif..),method = method)
}else{
Expand Down
9 changes: 8 additions & 1 deletion man/draw_boxplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d3db5e0

Please sign in to comment.