minor tidy and leble adjust sizes for simple barplots

This commit is contained in:
Tanushree Tunstall 2022-08-04 10:26:18 +01:00
parent bcba0c359e
commit 61c7a30835
3 changed files with 12 additions and 6 deletions

View file

@ -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) +