#!/usr/bin/env Rscript   getwd()
setwd("~/git/LSHTM_analysis/scripts/plotting")
getwd()

#########################################################
# TASK: combined barplots_subcols_aa plots: PS and LIG
#########################################################

#=======================================================================

############################################################
# 1: Installing and loading required packages and functions
############################################################
source("barplots_subcolours_aa_PS.R")
source("barplots_subcolours_aa_LIG.R")
source("dirs.R")
#=======
# output
#=======
# plot name and location
print(paste0("plot will be in:", plotdir))
bp_aa_subcols_combined = "barplot_acoloured_combined.svg"
plot_bp_aa_subcols_combined  = paste0(plotdir, "/", bp_aa_subcols_combined )
plot_bp_aa_subcols_combined 


bp_aa_subcols_combined_labelled = "barplot_acoloured_combined_labelled.svg"
plot_bp_aa_subcols_combined_labelled   = paste0(plotdir, "/", bp_aa_subcols_combined_labelled)
plot_bp_aa_subcols_combined_labelled  
#=======================================================================
#============================
# combined plot 2: UNlabelled
#============================
svg(plot_bp_aa_subcols_combined, width = 26, height = 8)
OutPlot_aa_subcols_combined = cowplot::plot_grid(OutPlot_aa_PS, OutPlot_aa_LIG
                                                          , ncol = 1
                                                          , align = 'v')
OutPlot_aa_subcols_combined
dev.off()


#============================
# combined plot 2: labelled
#============================
svg(plot_bp_aa_subcols_combined_labelled, width = 26, height = 8)
OutPlot_aa_subcols_combined_labelled = cowplot::plot_grid(OutPlot_aa_PS, OutPlot_aa_LIG
                                               , ncol = 1
                                               #, labels = c("(c)", "(d)")
                                               , labels = c("C", "D")
                                               , label_size = 20
                                               , align = 'v'
                                               , hjust = -0.1)
                                               #, vjust = 0)
OutPlot_aa_subcols_combined_labelled
dev.off()
