diff --git a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R index 590e18b6..e954e215 100644 --- a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R +++ b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R @@ -661,7 +661,8 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, page_width ymin = .data[[y_mean_col]] - .data[[y_sd_col]], ymax = .data[[y_mean_col]] + .data[[y_sd_col]], color = .data[[config$color_var]] - ) + ), + linewidth = 0.1 ) } else { # If a fixed error bar color is set, use it outside aes @@ -671,18 +672,32 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, page_width ymin = .data[[y_mean_col]] - .data[[y_sd_col]], ymax = .data[[y_mean_col]] + .data[[y_sd_col]] ), - color = config$error_bar_params$color + color = config$error_bar_params$color, + linewidth = 0.1 ) } # Add the center point if the option is provided - if (!is.null(config$error_bar_params$center_point)) { - plot <- plot + geom_point(aes( - x = .data[[config$x_var]], - y = .data[[y_mean_col]]), - color = config$error_bar_params$color, - shape = 16 - ) + if (!is.null(config$error_bar_params$mean_point) && config$error_bar_params$mean_point) { + if (!is.null(config$color_var) && is.null(config$error_bar_params$color)) { + plot <- plot + geom_point( + aes( + x = .data[[config$x_var]], + y = .data[[y_mean_col]], + color = .data[[config$color_var]] + ), + shape = 16 + ) + } else { + plot <- plot + geom_point( + aes( + x = .data[[config$x_var]], + y = .data[[y_mean_col]] + ), + color = config$error_bar_params$color, + shape = 16 + ) + } } } @@ -946,7 +961,7 @@ generate_interaction_plot_configs <- function(df_summary, df_interaction, type) plot_config$error_bar <- TRUE plot_config$error_bar_params <- list( color = "red", - center_point = TRUE, + mean_point = TRUE, y_mean_col = paste0("mean_mean_", var), y_sd_col = paste0("mean_sd_", var) )