generated labelled ps_plots_combined.R and capital "P" for position in barplots coloured aa for Lig
This commit is contained in:
parent
e60b4c5492
commit
9784cba232
2 changed files with 31 additions and 14 deletions
|
@ -20,7 +20,7 @@ library(ggplot2)
|
||||||
library(data.table)
|
library(data.table)
|
||||||
source("barplot_colour_function.R")
|
source("barplot_colour_function.R")
|
||||||
#source("subcols_axis.R")
|
#source("subcols_axis.R")
|
||||||
source("subcols_axis_PS.R")
|
source("subcols_axis.R")
|
||||||
|
|
||||||
# should return the following dfs, directories and variables
|
# should return the following dfs, directories and variables
|
||||||
# mut_pos_cols
|
# mut_pos_cols
|
||||||
|
@ -218,7 +218,7 @@ svg(plot_bp_aa_subcols_ligand, width = 26, height = 4)
|
||||||
|
|
||||||
g = ggplot(df, aes(factor(position, ordered = T)))
|
g = ggplot(df, aes(factor(position, ordered = T)))
|
||||||
|
|
||||||
outPlot = g +
|
OutPlot = g +
|
||||||
coord_cartesian(xlim = c(1, my_xlim)
|
coord_cartesian(xlim = c(1, my_xlim)
|
||||||
#, ylim = c(0, 6)
|
#, ylim = c(0, 6)
|
||||||
, ylim = c(0, max(snp_count))
|
, ylim = c(0, max(snp_count))
|
||||||
|
@ -249,10 +249,10 @@ outPlot = g +
|
||||||
, axis.ticks.x = element_blank()) +
|
, axis.ticks.x = element_blank()) +
|
||||||
labs(title = ""
|
labs(title = ""
|
||||||
#title = my_title
|
#title = my_title
|
||||||
, x = "position"
|
, x = "Position"
|
||||||
, y = "Frequency")
|
, y = "Frequency")
|
||||||
|
|
||||||
print(outPlot)
|
print(OutPlot)
|
||||||
dev.off()
|
dev.off()
|
||||||
|
|
||||||
#!!!!!!!!!!!!!!!!
|
#!!!!!!!!!!!!!!!!
|
||||||
|
|
|
@ -219,6 +219,7 @@ p2 = g2 +
|
||||||
, colour = "black"
|
, colour = "black"
|
||||||
, fill = "lightgray"
|
, fill = "lightgray"
|
||||||
, stat = "identity") +
|
, stat = "identity") +
|
||||||
|
scale_y_continuous(limits = c(0, 450))+
|
||||||
theme(axis.text.x = element_blank()
|
theme(axis.text.x = element_blank()
|
||||||
, axis.text.y = element_text(size = my_ats
|
, axis.text.y = element_text(size = my_ats
|
||||||
, angle = 0
|
, angle = 0
|
||||||
|
@ -235,17 +236,33 @@ p2
|
||||||
########################################################################
|
########################################################################
|
||||||
# end of DUET barplots #
|
# end of DUET barplots #
|
||||||
########################################################################
|
########################################################################
|
||||||
#=======
|
#============================
|
||||||
# output
|
# combined plot 1: UNlabelled
|
||||||
#=======
|
#============================
|
||||||
ps_plots_combined = "af_or_combined_PS.svg"
|
ps_combined = "af_or_combined_PS.svg"
|
||||||
plot_ps_plots_combined = paste0(plotdir,"/", ps_plots_combined )
|
plot_ps_combined = paste0(plotdir,"/", ps_combined)
|
||||||
|
cat("combined plot Unlabelled:", plot_ps_combined)
|
||||||
|
|
||||||
svg(plot_ps_plots_combined , width = 26, height = 12)
|
svg(plot_ps_combined , width = 26, height = 12)
|
||||||
|
OutPlot_combined = cowplot::plot_grid(p1, p2, p3
|
||||||
#theme_set(theme_gray()) # to preserve default theme
|
|
||||||
printFile = cowplot::plot_grid(p1, p2, p3
|
|
||||||
, ncol = 1
|
, ncol = 1
|
||||||
, align = 'v')
|
, align = 'v')
|
||||||
printFile
|
OutPlot_combined
|
||||||
|
dev.off()
|
||||||
|
|
||||||
|
#============================
|
||||||
|
# combined plot 2: labelled
|
||||||
|
#============================
|
||||||
|
ps_combined_labelled = "af_or_combined_PS_labelled.svg"
|
||||||
|
plot_ps_combined_labelled = paste0(plotdir,"/", ps_combined_labelled)
|
||||||
|
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'
|
||||||
|
, hjust = -0.4)
|
||||||
|
OutPlot_combined_labelled
|
||||||
dev.off()
|
dev.off()
|
Loading…
Add table
Add a link
Reference in a new issue