From 4ea2e6c6d3e9949426635bcdb5e68920e2d6ae98 Mon Sep 17 00:00:00 2001 From: Rosa Castillo Date: Sun, 7 Apr 2024 14:01:48 +0200 Subject: [PATCH] fixed plot_raw function --- R/002_plot_api.R | 6 +----- R/002_plot_utils.R | 7 ++++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/R/002_plot_api.R b/R/002_plot_api.R index c65dc1d..964b9d7 100644 --- a/R/002_plot_api.R +++ b/R/002_plot_api.R @@ -120,16 +120,12 @@ plot_raw <- function(dabest_effectsize_obj, float_contrast, plot_kwargs) { df_for_proportion_bar <- create_dfs_for_proportion_bar(proportion_success, bar_width = raw_bar_width) } - ## Adjustment of labels ## - if (ggplot2::as_label(enquo_colour) == "NULL" && main_plot_type != "slope") { - enquo_colour <- enquo_x - } - #### Initialise raw_plot & Add main_plot_type component #### output <- initialize_raw_plot(plot_kwargs, plot_components, dabest_effectsize_obj, df_for_proportion_bar, sankey_df, sankey_bars, idx, float_contrast) raw_plot <- output[[1]] raw_y_range <- output[[2]] raw_y_min <- output[[3]] + x_axis_raw <- output[[4]] #### Add tufte lines component #### if (is_tufte_lines) { diff --git a/R/002_plot_utils.R b/R/002_plot_utils.R index 197ed89..6c2c2b1 100644 --- a/R/002_plot_utils.R +++ b/R/002_plot_utils.R @@ -229,6 +229,11 @@ initialize_raw_plot <- function(plot_kwargs, plot_components, dabest_effectsize_ raw_flow_alpha <- plot_kwargs$raw_flow_alpha main_plot_type <- plot_components$main_plot_type is_summary_lines <- plot_components$is_summary_lines + + ## Adjustment of labels ## + if (ggplot2::as_label(enquo_colour) == "NULL" && main_plot_type != "slope") { + enquo_colour <- enquo_x + } # sankey params if (!is.null(sankey_df)) { @@ -368,7 +373,7 @@ initialize_raw_plot <- function(plot_kwargs, plot_components, dabest_effectsize_ ) ) } - return(list(raw_plot, raw_y_range, raw_y_min)) + return(list(raw_plot, raw_y_range, raw_y_min, x_axis_raw)) } adjust_x_axis_in_delta_plot <- function(delta_plot, main_plot_type, flow, idx, x, delta_y_min, delta_y_mean) {