This commit is contained in:
Tanushree Tunstall 2022-08-05 12:45:16 +01:00
parent 14f8f5d6d4
commit c0f59bc9c9
5 changed files with 74 additions and 12 deletions

View file

@ -23,14 +23,19 @@ lin_count_bp_diversity <- function( lf_data = lin_wf
, my_xals = 22 # x axis label size
, my_yals = 22 # y axis label size
, my_lls = 22 # legend label size
, bar_col_labels = c("Mutations", "Total Samples")
, bar_col_values = c("grey50", "gray75")
, bar_col_labels = "" #c("Mutations", "Total Samples")
, bar_col_values = c("gray50", "gray75")
, bar_leg_name = ""
, leg_location = "top"
, y_log10 = FALSE
, y_scale_percent = FALSE
#, y_label = c("Count", "SNP diversity")
, y_label = c("SNP diversity")
, bp_plot_title = ""
, title_colour = "chocolate4"
, subtitle_text = NULL
, sts = 20
, subtitle_colour = "#350E20FF" #brown
) {
if(!all_lineages){
lf_data = lf_data[lf_data[[x_categ]]%in%use_lineages,]
@ -58,7 +63,13 @@ lin_count_bp_diversity <- function( lf_data = lin_wf
, axis.title.y = element_text(size = my_yals
, colour = "black")
, legend.position = leg_location
, legend.text = element_text(size = my_lls)) +
, legend.text = element_text(size = my_lls)
, plot.title = element_text(size = my_lls
, colour = title_colour
, hjust = 0.5)
, plot.subtitle = element_text(size = sts
, hjust = 0.5
, colour = subtitle_colour)) +
geom_label(aes(label = eval(parse(text = display_label_col)))
, size = d_lab_size
@ -72,10 +83,16 @@ lin_count_bp_diversity <- function( lf_data = lin_wf
scale_fill_manual(values = bar_col_values
, name = bar_leg_name
, labels = bar_col_labels) +
labs(title = ""
, x = ""
, y = y_label
, colour = "black")
# labs(title = ""
# , x = ""
# , y = y_label
# , colour = "black")
#
labs(title = bp_plot_title
, subtitle = subtitle_text
, x = ""
, y = y_label
, colour = "black")
if (y_log10){
@ -90,10 +107,11 @@ lin_count_bp_diversity <- function( lf_data = lin_wf
scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
#scale_y_continuous(labels = scales::percent) +
labs(title = ""
, x = ""
, y = y_label
, colour = "black")
labs(title = bp_plot_title
, subtitle = subtitle_text
, x = ""
, y = y_label
, colour = "black")
}
return(OutPlot)