From 57433607bce431052d78959c0ea26090befc9b7c Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Fri, 5 Aug 2022 18:28:10 +0100 Subject: [PATCH] lf_bp2: add a "monochrome" option --- scripts/functions/lf_bp2.R | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/functions/lf_bp2.R b/scripts/functions/lf_bp2.R index 9734171..3a49621 100644 --- a/scripts/functions/lf_bp2.R +++ b/scripts/functions/lf_bp2.R @@ -37,15 +37,17 @@ lf_bp2 <- function(lf_df = lf_duet #fwv = reformulate(facet_var) # Only use the longer colour palette if there are many outcomes - if (length(levels(lf_df$outcome)) > 2) { - lf_bp_colours = consurf_bp_colours + 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) + } else { + if (length(levels(lf_df$outcome)) > 2) { + lf_bp_colours = consurf_bp_colours + } + else { + lf_bp_colours = hue_pal()(2) + } } - else { - lf_bp_colours =NULL - #lf_bp_colours = hue_pal()(2) - - } - if (bp_width == "auto"){ bp_width = 0.5/length(unique(lf_df[[x_grp]]))