added separate scripts for layout for convinience
This commit is contained in:
parent
d78b072732
commit
cd86fcf8e8
6 changed files with 468 additions and 78 deletions
163
scripts/plotting/plotting_thesis/dm_om_plots_layout.R
Normal file
163
scripts/plotting/plotting_thesis/dm_om_plots_layout.R
Normal file
|
@ -0,0 +1,163 @@
|
|||
# source dm_om_plots.R
|
||||
#============
|
||||
# Plot labels
|
||||
#============
|
||||
tit1 = "Stability changes"
|
||||
tit2 = "Genomic measure"
|
||||
tit3 = "Distance to partners"
|
||||
tit4 = "Evolutionary Conservation"
|
||||
tit5 = "Affinity changes"
|
||||
pt_size = 30
|
||||
|
||||
theme_georgia <- function(...) {
|
||||
theme_gray(base_family = "sans", ...) +
|
||||
theme(plot.title = element_text(face = "bold"))
|
||||
}
|
||||
|
||||
|
||||
title_theme <- calc_element("plot.title", theme_georgia())
|
||||
|
||||
pt1 = ggdraw() +
|
||||
draw_label(
|
||||
tit1,
|
||||
fontfamily = title_theme$family,
|
||||
fontface = title_theme$face,
|
||||
#size = title_theme$size
|
||||
size = pt_size
|
||||
)
|
||||
|
||||
pt2 = ggdraw() +
|
||||
draw_label(
|
||||
tit2,
|
||||
fontfamily = title_theme$family,
|
||||
fontface = title_theme$face,
|
||||
size = pt_size
|
||||
)
|
||||
|
||||
pt3 = ggdraw() +
|
||||
draw_label(
|
||||
tit3,
|
||||
fontfamily = title_theme$family,
|
||||
fontface = title_theme$face,
|
||||
size = pt_size
|
||||
)
|
||||
|
||||
pt4 = ggdraw() +
|
||||
draw_label(
|
||||
tit4,
|
||||
fontfamily = title_theme$family,
|
||||
fontface = title_theme$face,
|
||||
size = pt_size
|
||||
)
|
||||
|
||||
|
||||
pt5 = ggdraw() +
|
||||
draw_label(
|
||||
tit5,
|
||||
fontfamily = title_theme$family,
|
||||
fontface = title_theme$face,
|
||||
size = pt_size
|
||||
)
|
||||
|
||||
#======================
|
||||
# Output plot function
|
||||
#======================
|
||||
OutPlot_dm_om = function(x){
|
||||
|
||||
# dist b/w plot title and plot
|
||||
relH_tp = c(0.08, 0.92)
|
||||
|
||||
my_label_size = 25
|
||||
#----------------
|
||||
# Top panel
|
||||
#----------------
|
||||
top_panel = cowplot::plot_grid(
|
||||
cowplot::plot_grid(pt1,
|
||||
cowplot::plot_grid(duetP, foldxP, deepddgP, dynamut2P
|
||||
, nrow = 1
|
||||
, labels = c("A", "B", "C", "D")
|
||||
, label_size = my_label_size)
|
||||
, ncol = 1
|
||||
, rel_heights = relH_tp
|
||||
),
|
||||
NULL,
|
||||
cowplot::plot_grid(pt2,
|
||||
cowplot::plot_grid(genomicsP
|
||||
, nrow = 1
|
||||
, labels = c("E")
|
||||
, label_size = my_label_size)
|
||||
, ncol = 1
|
||||
, rel_heights = relH_tp
|
||||
),
|
||||
NULL,
|
||||
cowplot::plot_grid(pt3,
|
||||
cowplot::plot_grid( #distanceP
|
||||
distanceP_lig, distanceP_ppi2
|
||||
#, distanceP_na
|
||||
, nrow = 1
|
||||
, labels = c("F", "G")
|
||||
, label_size = my_label_size)
|
||||
, ncol = 1
|
||||
, rel_heights = relH_tp
|
||||
),
|
||||
nrow = 1,
|
||||
rel_widths = c(2/7, 0.1/7, 0.5/7, 0.1/7, 1/7)
|
||||
)
|
||||
|
||||
#----------------
|
||||
# Bottom panel
|
||||
#----------------
|
||||
bottom_panel = cowplot::plot_grid(
|
||||
cowplot::plot_grid(pt4,
|
||||
cowplot::plot_grid(consurfP, proveanP, snap2P
|
||||
, nrow = 1
|
||||
, labels = c("H", "I", "J")
|
||||
, label_size = my_label_size)
|
||||
, ncol = 1
|
||||
, rel_heights =relH_tp
|
||||
),NULL,
|
||||
cowplot::plot_grid(pt5,
|
||||
cowplot::plot_grid(mcsmligP, mcsmlig2P
|
||||
, mcsmppi2P
|
||||
#, mcsmnaP
|
||||
, nrow = 1
|
||||
, labels = c("K", "L", "M")
|
||||
, label_size = my_label_size)
|
||||
, ncol = 1
|
||||
, rel_heights = relH_tp
|
||||
),NULL,
|
||||
nrow = 1,
|
||||
rel_widths = c(3/6,0.1/6,3/6, 0.1/6 )
|
||||
)
|
||||
|
||||
#-------------------------------
|
||||
# combine: Top and Bottom panel
|
||||
#-------------------------------
|
||||
cowplot::plot_grid (top_panel, bottom_panel
|
||||
, nrow =2
|
||||
, rel_widths = c(1, 1)
|
||||
, align = "hv")
|
||||
}
|
||||
|
||||
#=====================
|
||||
# OutPlot: svg and png
|
||||
#======================
|
||||
dm_om_combinedP = paste0(outdir_images
|
||||
,tolower(gene)
|
||||
,"_dm_om_all.svg")
|
||||
|
||||
cat("DM OM plots with stats:", dm_om_combinedP)
|
||||
svg(dm_om_combinedP, width = 32, height = 18)
|
||||
|
||||
OutPlot_dm_om()
|
||||
dev.off()
|
||||
|
||||
|
||||
dm_om_combinedP_png = paste0(outdir_images
|
||||
,tolower(gene)
|
||||
,"_dm_om_all.png")
|
||||
cat("DM OM plots with stats:", dm_om_combinedP_png)
|
||||
png(dm_om_combinedP_png, width = 32, height = 18, units = "in", res = 300)
|
||||
|
||||
OutPlot_dm_om()
|
||||
dev.off()
|
Loading…
Add table
Add a link
Reference in a new issue