minor tidy and leble adjust sizes for simple barplots
This commit is contained in:
parent
bcba0c359e
commit
61c7a30835
3 changed files with 12 additions and 6 deletions
|
@ -95,7 +95,7 @@ site_snp_count_bp <- function (plotdf
|
|||
# FIXME: should really be legend title
|
||||
# but atm being using as plot title
|
||||
#my_leg_title
|
||||
bp_plot_title = paste0("Total nsSNPs: ", tot_muts
|
||||
bp_plot_title = paste0("Total SNPs: ", tot_muts
|
||||
, "\nTotal sites: ", tot_sites)
|
||||
|
||||
#-------------
|
||||
|
|
|
@ -24,16 +24,20 @@ stability_count_bp <- function(plotdf
|
|||
, geom_ls = 10 # geom_label size
|
||||
, yaxis_title = "Number of nsSNPs"
|
||||
, bp_plot_title = ""
|
||||
, label_categories = c("Destabilising", "Stabilising")
|
||||
, label_categories = c("LEVEL1", "LEVEL2")
|
||||
, title_colour = "chocolate4"
|
||||
, subtitle_text = NULL
|
||||
, sts = 20
|
||||
, subtitle_colour = "pink"
|
||||
, subtitle_colour = "#350E20FF" #brown
|
||||
#, leg_position = c(0.73,0.8) # within plot area
|
||||
, leg_position = "top"
|
||||
, bar_fill_values = c("#F8766D", "#00BFC4")){
|
||||
|
||||
# OutPlot_count = ggplot(plotdf, aes(x = eval(parse(text = df_colname)))) +
|
||||
|
||||
# convert to factor and get labels
|
||||
plotdf[[df_colname]] = as.factor(plotdf[[df_colname]])
|
||||
label_categories = levels(plotdf[[df_colname]])
|
||||
|
||||
#OutPlot_count = ggplot(plotdf, aes(x = eval(parse(text = df_colname)))) +
|
||||
OutPlot_count = ggplot(plotdf, aes_string(x = df_colname)) +
|
||||
geom_bar(aes(fill = eval(parse(text = df_colname))), show.legend = TRUE) +
|
||||
geom_label(stat = "count"
|
||||
|
@ -57,6 +61,7 @@ stability_count_bp <- function(plotdf
|
|||
labs(title = bp_plot_title
|
||||
, subtitle = subtitle_text
|
||||
, y = yaxis_title) +
|
||||
|
||||
scale_fill_discrete(name = leg_title
|
||||
, labels = label_categories) +
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue