From 036cc14e40906b2135117ff61b8e6b0f2c0de669 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Tue, 14 Sep 2021 15:36:05 +0100 Subject: [PATCH] updated my_pairs_panel.R to make the dots coloured --- scripts/functions/my_pairs_panel.R | 44 ++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/scripts/functions/my_pairs_panel.R b/scripts/functions/my_pairs_panel.R index 0c73192..eb0268a 100644 --- a/scripts/functions/my_pairs_panel.R +++ b/scripts/functions/my_pairs_panel.R @@ -1,24 +1,40 @@ -my_corr_pairs <- function (corr_data){ +my_corr_pairs <- function (corr_data_all + , corr_data_range = 1:length(corr_data_all) + , corr_method = "spearman" # other options: "pearson" or "kendall" + , colour_categ_col = "mutation_info_labels" + , categ_colour = c("#E69F00", "#999999") + , density_show = F + , hist_col = "coral4" + , dot_size = 1.6 + , ats = 1 + , corr_lab_size = 1 + , corr_value_size = 1) + { - OutPlot_corr = pairs.panels(corr_data - , method = "spearman" # correlation method - , hist.col = "grey" ##00AFBB - , density = TRUE # show density plots - , ellipses = F # show correlation ellipses + corr_data_df = corr_data_all[corr_data_range] + my_bg = categ_colour[corr_data_all[[colour_categ_col]] ] + + OutPlot_corr = pairs.panels(corr_data_df + , method = corr_method + , hist.col = hist_col + , density = density_show + , ellipses = F + , smooth = F , stars = T , rug = F , breaks = "Sturges" , show.points = T - #, bg = c("#f8766d", "#00bfc4")[unclass(factor(corr_ps$duet_outcome))] # foldx colours are reveresed - #, pch = 21 # for bg - , jitter = T + #, bg = c("#f8766d", "#00bfc4")[unclass(factor(corr_data$duet_outcome))] # foldx colours are reveresed + , bg = my_bg + , pch = 21 , alpha = 1 - , cex = 1.8 - , cex.axis = 2 - , cex.labels = 3.5 - , cex.cor = 1 - , smooth = F) + , cex = dot_size + , cex.axis = ats + , cex.labels = corr_lab_size + , cex.cor = corr_value_size + ) return(OutPlot_corr) + #return (my_bg) }