From c8f3ddf8926fdcb8cc4cc36e505320de05c167f9 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Sat, 13 Aug 2022 15:40:25 +0100 Subject: [PATCH] colour changes --- scripts/functions/bp_subcolours.R | 2 ++ .../functions/generate_distance_colour_map.R | 9 ++++---- scripts/functions/logoP_snp.R | 2 +- .../position_annotation.R | 15 ++++++------ .../plotting_thesis/corr_plots_thesis.R | 23 +++++++++++++++---- 5 files changed, 34 insertions(+), 17 deletions(-) rename scripts/{plotting => functions}/position_annotation.R (86%) diff --git a/scripts/functions/bp_subcolours.R b/scripts/functions/bp_subcolours.R index 24a6a58..29e79df 100755 --- a/scripts/functions/bp_subcolours.R +++ b/scripts/functions/bp_subcolours.R @@ -124,6 +124,8 @@ bp_stability_hmap <- function(plot_df = merged_df3 , axis.title.y = element_text(size = my_yaxts ) , plot.title = element_text(size = my_pts , hjust = 0.5) + , panel.grid = element_blank() + , panel.background = element_rect(fill = "transparent", colour=NA) ) + labs(title = p_title diff --git a/scripts/functions/generate_distance_colour_map.R b/scripts/functions/generate_distance_colour_map.R index 75a2d46..301dfb7 100644 --- a/scripts/functions/generate_distance_colour_map.R +++ b/scripts/functions/generate_distance_colour_map.R @@ -2,7 +2,8 @@ generate_distance_colour_map = function(plot_df, xvar_colname = "position", lig_dist_colname = "ligand_distance", - lig_dist_colours = c("green", "yellow", "orange", "red"), + #lig_dist_colours = c("green", "yellow", "orange", "red"), + lig_dist_colours = c("tan", "black"), debug = TRUE ) { @@ -74,9 +75,9 @@ generate_distance_legend = function(plot_df, geom_tile(aes(fill = .data[[lig_dist_colname]]) , colour = "white") + scale_fill_gradient2(midpoint = lig_mean - , low = "green" - , mid = "yellow" - , high = "red" + , low = "tan" + , mid = "grey50" + , high = "black" , breaks = labels , limits = c(lig_min, lig_max) , labels = labelsD diff --git a/scripts/functions/logoP_snp.R b/scripts/functions/logoP_snp.R index c492513..1046f45 100644 --- a/scripts/functions/logoP_snp.R +++ b/scripts/functions/logoP_snp.R @@ -201,7 +201,7 @@ LogoPlotSnps <- function(plot_df cat('\nSelected colour scheme:', my_logo_col , "\nUsing grey theme") - theme_bgc = "grey" + theme_bgc = "white" xfont_bgc = "black" yfont_bgc = "black" xtt_col = "black" diff --git a/scripts/plotting/position_annotation.R b/scripts/functions/position_annotation.R similarity index 86% rename from scripts/plotting/position_annotation.R rename to scripts/functions/position_annotation.R index cd39cf1..706ddd4 100644 --- a/scripts/plotting/position_annotation.R +++ b/scripts/functions/position_annotation.R @@ -31,20 +31,21 @@ position_annotation=function(plot_df, bg="transparent"){ scale_x_discrete("Position", labels=factor(plot_df$position)) + scale_color_manual(values = c( "brown"="brown", - "purple"="purple", + "green"="green", "transparent"="transparent", - "blue"="blue", "cyan"="cyan", - "cornflowerblue"="cornflowerblue" + "slategrey"="slategrey", + "navyblue"="navyblue", + "purple"="purple" ), expand=c(0,0) ) + scale_fill_manual(values = c( "brown"="brown", - "purple"="purple", + "green"="green", "transparent"="transparent", - "blue"="blue", - "cyan"="cyan", - "cornflowerblue"="cornflowerblue" + "slategrey"="slategrey", + "navyblue"="navyblue", + "purple"="purple" ), expand=c(0,0) ) + diff --git a/scripts/plotting/plotting_thesis/corr_plots_thesis.R b/scripts/plotting/plotting_thesis/corr_plots_thesis.R index 2681ecb..b9c6bf9 100644 --- a/scripts/plotting/plotting_thesis/corr_plots_thesis.R +++ b/scripts/plotting/plotting_thesis/corr_plots_thesis.R @@ -321,12 +321,25 @@ svg('/tmp/foo.svg', width=10, height=10, ) corr_plotting_df = corr_df_ps -ggpairs(corr_plotting_df, columns = 1:(ncol(corr_plotting_df)-1) - , upper = list(continuous = wrap('cor', method = "spearman")) - , aes(colour = factor(dst_mode), alpha = 0.5) - , title="correlogram with ggpairs()") + +ggpairs(corr_plotting_df, columns = 1:(ncol(corr_plotting_df)-1), + upper = list(continuous = wrap('cor', + method = "spearman", + title="ρ", + digits=2, + title_args=c(colour="black") + ) + ), + lower = list( + continuous = wrap("points", alpha = 0.7, size=0.5), + combo = wrap("dot", alpha = 0.7, size=0.5) + ), + aes(colour = factor(ifelse(corr_plotting_df$dst_mode==0, "S", "R")), alpha = 0.5), + title="Stability") + scale_colour_manual(values = c("red", "blue")) + - scale_fill_manual(values = c("red", "blue")) + scale_fill_manual(values = c("red", "blue")) + + theme( + text = element_text(size=12, face="bold") + ) dev.off()