added function and test for aa_prop_bp.R

This commit is contained in:
Tanushree Tunstall 2021-06-14 09:22:05 +01:00
parent 140bdc6d96
commit 2a8133898f
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,22 @@
library(ggplot2)
library(tidyverse)
library(data.table)
########################################################################
# TASK: barplots to colour nssnps by chosen aa_property
########################################################################
aa_prop_bp <- function(plotdf
, position_colname
, fill_colname
, fill_colours
, leg_name = "LEGEND"){
mp = ggplot(df, aes(x = as.factor(eval(parse(text = pos_colname)))
#, y = ..count..
, fill = eval(parse(text = fill_colname))
)) +
geom_bar(position = 'identity') +
scale_fill_manual(values = fill_colours
, name = leg_name)
return(mp)
}