more plot modifications dm and om plots mainly

This commit is contained in:
Tanushree Tunstall 2022-08-08 15:32:16 +01:00
parent 4e6f10d1ba
commit 0234a8f77b
6 changed files with 501 additions and 358 deletions

View file

@ -6,9 +6,11 @@
# beeswarm
#############################
lf_bp2 <- function(lf_df = lf_duet
lf_bp2 <- function(lf_df #lf_duet
, p_title = ""
, colour_categ = "outcome"
#, colour_categ = "outcome"
, colour_categ = "mutation_info_labels"
, dot_colours = c("red", "blue")
, x_grp = "mutation_info_labels"
, y_var = "param_value"
, facet_var = "param_type"
@ -16,7 +18,7 @@ lf_bp2 <- function(lf_df = lf_duet
, y_scales = "free_y"
, colour_bp_strip = "khaki2"
, dot_size = 3
, dot_transparency = 0.5
, dot_transparency = 1 #0.3: lighter
, violin_quantiles = c(0.25, 0.5, 0.75) # can be NULL
, my_ats = 22 # axis text size
, my_als = 20 # axis label size
@ -38,14 +40,16 @@ lf_bp2 <- function(lf_df = lf_duet
# Only use the longer colour palette if there are many outcomes
if (monochrome) {
lf_bp_colours = c(1:length(levels(lf_df$outcome)))
lf_bp_colours[c(1:length(levels(lf_df$outcome)))] = rgb(0,0,0)
lf_bp_colours = c(1:length(levels(lf_df[[colour_categ]])))
lf_bp_colours[c(1:length(levels(lf_df[[colour_categ]])))] = rgb(0,0,0)
} else {
if (length(levels(lf_df$outcome)) > 2) {
if (length(levels(lf_df[[colour_categ]])) > 2) {
lf_bp_colours = consurf_bp_colours
}
else {
lf_bp_colours = hue_pal()(2)
#lf_bp_colours = hue_pal()(2)
lf_bp_colours = dot_colours
}
}
@ -58,7 +62,6 @@ lf_bp2 <- function(lf_df = lf_duet
ggplot(lf_df, aes_string(x = x_grp, y = y_var)) +
facet_wrap(fwv
, nrow = n_facet_row
, scales = y_scales) +
@ -67,6 +70,7 @@ lf_bp2 <- function(lf_df = lf_duet
geom_violin(trim = T
, scale = "width"
, colour = "black"
#, position = position_dodge(width = 0.9)
, draw_quantiles = violin_quantiles) +