gg pairs fixup for alr
This commit is contained in:
parent
5b89beb2b5
commit
c3067b9176
1 changed files with 43 additions and 25 deletions
|
@ -1,6 +1,6 @@
|
||||||
#source("~/git/LSHTM_analysis/config/embb.R")
|
#source("~/git/LSHTM_analysis/config/alr.R")
|
||||||
#source("~/git/LSHTM_analysis/scripts/plotting/plotting_colnames.R")
|
|
||||||
#source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R")
|
#source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R")
|
||||||
|
#source("~/git/LSHTM_analysis/scripts/plotting/plotting_colnames.R")
|
||||||
|
|
||||||
#=======
|
#=======
|
||||||
# output
|
# output
|
||||||
|
@ -8,20 +8,38 @@
|
||||||
outdir_images = paste0("/home/pub/Work/LSHTM/Thesis_Plots/pairs/")
|
outdir_images = paste0("/home/pub/Work/LSHTM/Thesis_Plots/pairs/")
|
||||||
#cat("plots will output to:", outdir_images)
|
#cat("plots will output to:", outdir_images)
|
||||||
|
|
||||||
|
custom_cor <- function(data, mapping, method, ...){
|
||||||
|
x <- eval_data_col(data, mapping$x)
|
||||||
|
y <- eval_data_col(data, mapping$y)
|
||||||
|
|
||||||
|
corr <- cor(x, y, method=method, use='complete.obs')
|
||||||
|
|
||||||
|
ggally_text(
|
||||||
|
label = paste0("ρ: ",as.character(round(corr, 2))),
|
||||||
|
mapping = aes(),
|
||||||
|
xP = 0.5, yP = 0.5,
|
||||||
|
color = 'black',
|
||||||
|
...
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
my_gg_pairs=function(plot_df, plot_title
|
my_gg_pairs=function(plot_df, plot_title
|
||||||
, tt_args_size = 2.5
|
, tt_args_size = 2.5
|
||||||
, gp_args_size = 2.5){
|
, gp_args_size = 2.5){
|
||||||
ggpairs(plot_df,
|
ggpairs(plot_df,
|
||||||
columns = 1:(ncol(plot_df)-1),
|
columns = 1:(ncol(plot_df)-1),
|
||||||
upper = list(
|
upper = list(
|
||||||
continuous = wrap('cor', # ggally_cor()
|
continuous = wrap(custom_cor, method="spearman"
|
||||||
method = "spearman",
|
# ggally_cor, # ggally_cor()
|
||||||
use = "pairwise.complete.obs",
|
# method = "spearman",
|
||||||
title="ρ",
|
# use = "pairwise.complete.obs",
|
||||||
digits=2,
|
# title="XXX ρ",
|
||||||
justify_labels = "centre",
|
# digits=2,
|
||||||
title_args=list(size=tt_args_size, colour="black")#,#2.5
|
# justify_labels = "centre",
|
||||||
#group_args=list(size=gp_args_size)#2.5
|
# title_args=list(size=tt_args_size, colour="black")#,#2.5
|
||||||
|
# #group_args=list(size=gp_args_size)#2.5
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
lower = list(
|
lower = list(
|
||||||
|
@ -29,22 +47,22 @@ my_gg_pairs=function(plot_df, plot_title
|
||||||
"points",
|
"points",
|
||||||
alpha = 0.7,
|
alpha = 0.7,
|
||||||
size=0.125
|
size=0.125
|
||||||
|
),
|
||||||
|
combo = wrap(
|
||||||
|
"dot",
|
||||||
|
alpha = 0.7,
|
||||||
|
size=0.125)
|
||||||
),
|
),
|
||||||
combo = wrap(
|
# aes(colour = factor(ifelse(dst_mode==0,
|
||||||
"dot",
|
# "S",
|
||||||
alpha = 0.7,
|
# "R") ),
|
||||||
size=0.125)
|
# alpha = 0.5),
|
||||||
),
|
title=plot_title) #+
|
||||||
# aes(colour = factor(ifelse(dst_mode==0,
|
#
|
||||||
# "S",
|
# scale_colour_manual(values = c("red", "blue")) +
|
||||||
# "R") ),
|
# scale_fill_manual(values = c("red", "blue")) #+
|
||||||
# alpha = 0.5),
|
# theme(text = element_text(size=7,
|
||||||
title=plot_title) #+
|
# face="bold"))
|
||||||
#
|
|
||||||
# scale_colour_manual(values = c("red", "blue")) +
|
|
||||||
# scale_fill_manual(values = c("red", "blue")) #+
|
|
||||||
# theme(text = element_text(size=7,
|
|
||||||
# face="bold"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DistCutOff = 10
|
DistCutOff = 10
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue