From 02fae30c2959fb224f721013755f80c3a0270637 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Fri, 9 Oct 2020 13:10:08 +0100 Subject: [PATCH] changing labels in graphs for frontiers journal --- .../barplots_subcolours_aa_combined.R | 3 ++- scripts/plotting/basic_barplots_foldx.R | 22 +++++++++++++++++++ scripts/plotting/hist_af_or_combined.R | 12 +++++----- scripts/plotting/or_plots_combined.R | 5 +++-- scripts/plotting/ps_plots_combined.R | 9 ++++---- 5 files changed, 39 insertions(+), 12 deletions(-) diff --git a/scripts/plotting/barplots_subcolours_aa_combined.R b/scripts/plotting/barplots_subcolours_aa_combined.R index 00026da..36ff178 100755 --- a/scripts/plotting/barplots_subcolours_aa_combined.R +++ b/scripts/plotting/barplots_subcolours_aa_combined.R @@ -45,7 +45,8 @@ dev.off() 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)") + , labels = c("C", "D") , label_size = 20 , align = 'v' , hjust = -0.1) diff --git a/scripts/plotting/basic_barplots_foldx.R b/scripts/plotting/basic_barplots_foldx.R index f695cc1..66d8029 100755 --- a/scripts/plotting/basic_barplots_foldx.R +++ b/scripts/plotting/basic_barplots_foldx.R @@ -99,5 +99,27 @@ dev.off() table(df$foldx_outcome) #======================================================================= +g = ggplot(df, aes(x = foldx_outcome)) +OutPlot_count = g + geom_bar(aes(show.legend = TRUE)) + + geom_label(stat = "count" + , aes(label = ..count..) + , color = "black" + , show.legend = FALSE + , size = 10) + + theme(axis.text.x = element_blank() + , axis.title.x = element_blank() + , axis.title.y = element_text(size=my_als) + , axis.text.y = element_text(size = my_ats) + , legend.position = c(0.73,0.8) + , legend.text = element_text(size=my_als-2) + , legend.title = element_text(size=my_als) + , plot.title = element_blank()) + + labs(title = "" + , y = "Number of SNPs" + #, fill="FoldX Outcome" + ) + scale_fill_manual("legend", values = c("Destabilising" = "black", "Stabilising" = "orange")) + + scale_fill_discrete(name = "FoldX Outcome" + , labels = c("Destabilising", "Stabilising")) +print(OutPlot_count) diff --git a/scripts/plotting/hist_af_or_combined.R b/scripts/plotting/hist_af_or_combined.R index af1216b..aa828be 100644 --- a/scripts/plotting/hist_af_or_combined.R +++ b/scripts/plotting/hist_af_or_combined.R @@ -29,7 +29,7 @@ source("combining_dfs_plotting.R") # output #======= # plot: with median line on hist -af_or_combined_med = "hist_bp_muts_combined_median.svg" +af_or_combined_med = "hist_bp_muts_combined_median_labelled.svg" plot_af_or_combined_med = paste0(plotdir, "/", af_or_combined_med) # plot 6: without median line on hist @@ -300,8 +300,9 @@ p1_af = cowplot::plot_grid(g_af_hist #, g_af_mutinfo # without median line , g_af_bp_stats , nrow = 1 - , labels = c("(a)", "(b)", "(c)") - , hjust = -0.5 + #, labels = c("(a)", "(b)", "(c)") + , labels = c("A", "B", "C") + , hjust = -1.5 , vjust = 0.2 , rel_widths = c(1.2/4, 2/4, 0.8/4) , label_size = 18) @@ -319,8 +320,9 @@ p2_or = cowplot::plot_grid(g_or_hist #, g_or_mutinfo # without median line , g_or_bp_stats , nrow = 1 - , labels = c("(d)", "(e)", "(f)") - , hjust = -0.5 + #, labels = c("(d)", "(e)", "(f)") + , labels = c("D", "E", "F") + , hjust = -1.5 , vjust = 0.2 , rel_widths = c(1.2/4, 2/4, 0.8/4) , label_size = 18) diff --git a/scripts/plotting/or_plots_combined.R b/scripts/plotting/or_plots_combined.R index ff39284..c3f1cc6 100644 --- a/scripts/plotting/or_plots_combined.R +++ b/scripts/plotting/or_plots_combined.R @@ -213,7 +213,8 @@ theme_set(theme_gray()) # to preserve default theme Outplot_or_combined_labelled = cowplot::plot_grid(plot_grid(p1, p2 , ncol = 1 , align = 'v' - , labels = c("(a)", "(b)") - , label_size = 20)) + #, labels = c("(a)", "(b)") + , labels = "AUTO" + , label_size = 26)) print(Outplot_or_combined_labelled) dev.off() \ No newline at end of file diff --git a/scripts/plotting/ps_plots_combined.R b/scripts/plotting/ps_plots_combined.R index d62d8ee..95b495b 100644 --- a/scripts/plotting/ps_plots_combined.R +++ b/scripts/plotting/ps_plots_combined.R @@ -260,9 +260,10 @@ cat("combined plot Labelled:", plot_ps_combined_labelled) svg(plot_ps_combined_labelled , width = 26, height = 12) OutPlot_combined_labelled = cowplot::plot_grid(p1, p2, p3 , ncol = 1 - , labels = c("(a)", "(b)", "(c)") - , label_size = 21 - , align = 'v' + #, labels = c("(a)", "(b)", "(c)") + , labels = "AUTO" + , label_size = 25 + , align = 'hv' , hjust = -0.4) OutPlot_combined_labelled -dev.off() \ No newline at end of file +dev.off()