added function and test for aa_prop_bp.R
This commit is contained in:
parent
140bdc6d96
commit
2a8133898f
2 changed files with 84 additions and 0 deletions
22
scripts/functions/aa_prop_bp.R
Normal file
22
scripts/functions/aa_prop_bp.R
Normal 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)
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue