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/scripts/plotting/plotting_colnames.R")
|
||||
#source("~/git/LSHTM_analysis/config/alr.R")
|
||||
#source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R")
|
||||
#source("~/git/LSHTM_analysis/scripts/plotting/plotting_colnames.R")
|
||||
|
||||
#=======
|
||||
# output
|
||||
|
@ -8,20 +8,38 @@
|
|||
outdir_images = paste0("/home/pub/Work/LSHTM/Thesis_Plots/pairs/")
|
||||
#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
|
||||
, tt_args_size = 2.5
|
||||
, gp_args_size = 2.5){
|
||||
ggpairs(plot_df,
|
||||
columns = 1:(ncol(plot_df)-1),
|
||||
upper = list(
|
||||
continuous = wrap('cor', # ggally_cor()
|
||||
method = "spearman",
|
||||
use = "pairwise.complete.obs",
|
||||
title="ρ",
|
||||
digits=2,
|
||||
justify_labels = "centre",
|
||||
title_args=list(size=tt_args_size, colour="black")#,#2.5
|
||||
#group_args=list(size=gp_args_size)#2.5
|
||||
continuous = wrap(custom_cor, method="spearman"
|
||||
# ggally_cor, # ggally_cor()
|
||||
# method = "spearman",
|
||||
# use = "pairwise.complete.obs",
|
||||
# title="XXX ρ",
|
||||
# digits=2,
|
||||
# justify_labels = "centre",
|
||||
# title_args=list(size=tt_args_size, colour="black")#,#2.5
|
||||
# #group_args=list(size=gp_args_size)#2.5
|
||||
)
|
||||
),
|
||||
lower = list(
|
||||
|
@ -29,22 +47,22 @@ my_gg_pairs=function(plot_df, plot_title
|
|||
"points",
|
||||
alpha = 0.7,
|
||||
size=0.125
|
||||
),
|
||||
combo = wrap(
|
||||
"dot",
|
||||
alpha = 0.7,
|
||||
size=0.125)
|
||||
),
|
||||
combo = wrap(
|
||||
"dot",
|
||||
alpha = 0.7,
|
||||
size=0.125)
|
||||
),
|
||||
# aes(colour = factor(ifelse(dst_mode==0,
|
||||
# "S",
|
||||
# "R") ),
|
||||
# alpha = 0.5),
|
||||
title=plot_title) #+
|
||||
#
|
||||
# scale_colour_manual(values = c("red", "blue")) +
|
||||
# scale_fill_manual(values = c("red", "blue")) #+
|
||||
# theme(text = element_text(size=7,
|
||||
# face="bold"))
|
||||
# aes(colour = factor(ifelse(dst_mode==0,
|
||||
# "S",
|
||||
# "R") ),
|
||||
# alpha = 0.5),
|
||||
title=plot_title) #+
|
||||
#
|
||||
# scale_colour_manual(values = c("red", "blue")) +
|
||||
# scale_fill_manual(values = c("red", "blue")) #+
|
||||
# theme(text = element_text(size=7,
|
||||
# face="bold"))
|
||||
}
|
||||
|
||||
DistCutOff = 10
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue