## Section: boxplots
##################################################
## Section: generate the dataframe
##################################################
df <- data.frame(cbind('type' = c(rep('stable',length(st)), rep('specific', length(de))),
'value' = c(st, de)))
df$type <- factor(df$type, levels = c('stable', 'specific'))
df$value <- as.numeric(as.character(df$value))
## Section: seting plot parameters
##################################################
my_comparisons <- list(c('stable','specific'))
stat_box_data <- function(y, upper_limit = quantile(df$value, 0.50) ) {
return( data.frame( y = upper_limit,
label = paste('count =', length(y), '\n','median =', 10^median(y), '\n')))
}
fontsize = 4
linesize = 1
ggboxplot(df, x = "type", y = "value",
color = 'type', size = .3, font.label = list(size = fontsize), outlier.shape = NA)+
stat_summary(fun.data = stat_box_data, geom = "text", hjust = 0.5,vjust = 0.9)+
theme(legend.position = "none", axis.ticks.x = element_blank())+
stat_compare_means(comparisons = my_comparisons, label.y = c(6),method = 't.test', size = 2) +
ylab('log10 loop size')+ xlab('loop types by CBS')+ ggtitle(label = "wtdm") +# labs
coord_cartesian(ylim = c(4.5,7))