one function with tuned params to generate count and diversity barplot

This commit is contained in:
Tanushree Tunstall 2021-09-06 19:52:56 +01:00
parent 7ba6868b60
commit 357ceb8920

View file

@ -1,5 +1,7 @@
########################################
# Lineage and within SNP count barplot
# Lineage barplot
# Lineage and nsSNP count barplot
# Lineage Diversity barplot
########################################
lin_count_bp <- function( lf_data
@ -89,84 +91,3 @@ lin_count_bp <- function( lf_data
return(OutPlot)
}
############################
# Lineage diversity barplot
############################
# lin_diversity_bp <- function( wf_data
# , x_categ = "sel_lineages"
# , y_count = "snp_diversity"
# , bar_stat_stype = "identity"
# , display_label_col = "snp_diversity_f"
# , x_lab_angle = 90
# , d_lab_size = 5
# , d_lab_hjust = 0.5
# , d_lab_vjust = 0.5
# , d_lab_col = "black"
# , my_xats = 20 # x axis text size
# , my_yats = 20 # y axis text size
# , my_xals = 22 # x axis label size
# , my_yals = 22 # y axis label size
# , my_lls = 22 # legend label size
# , bar_leg_name = ""
# , leg_location = "top"
# , y_scale_percent = TRUE
# , y_label = "SNP diversity" )
#
# {
# g = ggplot(wf_data
# , aes( x = factor( eval(parse(text = x_categ)), ordered = T )
# , y = eval(parse(text = y_count)) ) )
#
# OutPlot = g + geom_bar( stat = bar_stat_stype
# , position = position_stack(reverse = TRUE)
# ) +
#
# theme(axis.text.x = element_text(size = my_xats
# , angle = x_lab_angle)
# , axis.text.y = element_text(size = my_yats
# , angle = 90
# , hjust = 1
# , vjust = 0)
# , axis.title.x = element_text(size = my_xals
# , colour = "black")
# , axis.title.y = element_text(size = my_yals
# , colour = "black")
# , legend.position = leg_location
# , legend.text = element_text(size = my_lls)) +
#
# geom_label(aes(label = eval(parse(text = display_label_col)))
# , size = d_lab_size
# , hjust = d_lab_hjust
# , vjust = d_lab_vjust
# , colour = d_lab_col
# , show.legend = FALSE
# #, check_overlap = TRUE
# , position = position_stack(reverse = T))
# # return(OutPlot)
#
# if (y_scale_percent){
#
# OutPlot = OutPlot +
# scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
# labs(title = ""
# , x = ""
# , y = y_label
# , colour = "black")
#
# return(OutPlot)
# }
# return(OutPlot)
# }
# ggp <- ggplot(bar_sel, aes(sel_lineages, snp_diversity)) +
# geom_bar(stat = "identity")
# ggp + scale_y_continuous(labels = scales::percent_format(accuracy = 1)
# #, limits = c(0,1)
# , breaks = seq(0, 30, 5)
# )