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
|
@ -223,7 +223,8 @@ consurf_palette2 = c("0" = "yellow2"
|
||||||
, "9" = "darkorchid4")
|
, "9" = "darkorchid4")
|
||||||
|
|
||||||
|
|
||||||
consurf_colours = c("0" = rgb(1.00,1.00,0.59)
|
consurf_colours = c(#"0" = rgb(1.00,1.00,0.59)
|
||||||
|
"nsd" = rgb(1.00,1.00,0.59)
|
||||||
, "1" = rgb(0.63,0.16,0.37)
|
, "1" = rgb(0.63,0.16,0.37)
|
||||||
, "2" = rgb(0.94,0.49,0.67)
|
, "2" = rgb(0.94,0.49,0.67)
|
||||||
, "3" = rgb(0.98,0.78,0.86)
|
, "3" = rgb(0.98,0.78,0.86)
|
||||||
|
|
|
@ -95,7 +95,7 @@ site_snp_count_bp <- function (plotdf
|
||||||
# FIXME: should really be legend title
|
# FIXME: should really be legend title
|
||||||
# but atm being using as plot title
|
# but atm being using as plot title
|
||||||
#my_leg_title
|
#my_leg_title
|
||||||
bp_plot_title = paste0("Total nsSNPs: ", tot_muts
|
bp_plot_title = paste0("Total SNPs: ", tot_muts
|
||||||
, "\nTotal sites: ", tot_sites)
|
, "\nTotal sites: ", tot_sites)
|
||||||
|
|
||||||
#-------------
|
#-------------
|
||||||
|
|
|
@ -24,15 +24,19 @@ stability_count_bp <- function(plotdf
|
||||||
, geom_ls = 10 # geom_label size
|
, geom_ls = 10 # geom_label size
|
||||||
, yaxis_title = "Number of nsSNPs"
|
, yaxis_title = "Number of nsSNPs"
|
||||||
, bp_plot_title = ""
|
, bp_plot_title = ""
|
||||||
, label_categories = c("Destabilising", "Stabilising")
|
, label_categories = c("LEVEL1", "LEVEL2")
|
||||||
, title_colour = "chocolate4"
|
, title_colour = "chocolate4"
|
||||||
, subtitle_text = NULL
|
, subtitle_text = NULL
|
||||||
, sts = 20
|
, sts = 20
|
||||||
, subtitle_colour = "pink"
|
, subtitle_colour = "#350E20FF" #brown
|
||||||
#, leg_position = c(0.73,0.8) # within plot area
|
#, leg_position = c(0.73,0.8) # within plot area
|
||||||
, leg_position = "top"
|
, leg_position = "top"
|
||||||
, bar_fill_values = c("#F8766D", "#00BFC4")){
|
, bar_fill_values = c("#F8766D", "#00BFC4")){
|
||||||
|
|
||||||
|
# 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(x = eval(parse(text = df_colname)))) +
|
||||||
OutPlot_count = ggplot(plotdf, aes_string(x = df_colname)) +
|
OutPlot_count = ggplot(plotdf, aes_string(x = df_colname)) +
|
||||||
geom_bar(aes(fill = eval(parse(text = df_colname))), show.legend = TRUE) +
|
geom_bar(aes(fill = eval(parse(text = df_colname))), show.legend = TRUE) +
|
||||||
|
@ -57,6 +61,7 @@ stability_count_bp <- function(plotdf
|
||||||
labs(title = bp_plot_title
|
labs(title = bp_plot_title
|
||||||
, subtitle = subtitle_text
|
, subtitle = subtitle_text
|
||||||
, y = yaxis_title) +
|
, y = yaxis_title) +
|
||||||
|
|
||||||
scale_fill_discrete(name = leg_title
|
scale_fill_discrete(name = leg_title
|
||||||
, labels = label_categories) +
|
, labels = label_categories) +
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue