diff --git a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R index 98345509..5a7a28af 100644 --- a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R +++ b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R @@ -776,19 +776,15 @@ generate_scatter_plot <- function(plot, config) { plot <- plot + geom_point(shape = 3, color = "gray70", size = 1) } - # Add Smooth Line if specified - if (!is.null(config$smooth) && config$smooth) { - smooth_color <- if (!is.null(config$smooth_color)) config$smooth_color else "blue" - - if (!is.null(config$lm_line)) { - plot <- plot + - geom_abline( - intercept = config$lm_line$intercept, - slope = config$lm_line$slope, - color = smooth_color, - linewidth = 1 - ) - } + # Add linear regression line if specified + if (!is.null(config$lm_line)) { + plot <- plot + + geom_abline( + intercept = config$lm_line$intercept, + slope = config$lm_line$slope, + color = ifelse(!is.null(config$lm_line$color), config$lm_line$color, "blue"), + linewidth = ifelse(!is.null(config$lm_line$linewidth), config$lm_line$linewidth, 1) + ) } # Add SD Bands if specified @@ -1072,11 +1068,11 @@ generate_interaction_plot_configs <- function(df_summary, df_interaction, type) x_labels = as.character(unique(group_data$conc_num)), ylim_vals = y_limits, y_filter = FALSE, - smooth = TRUE, lm_line = list( intercept = lm_intercept_value, slope = lm_slope_value, - color = "blue" + color = "blue", + linewidth = 1 ) ) delta_plot_configs <- append(delta_plot_configs, list(plot_config)) @@ -1219,11 +1215,10 @@ generate_correlation_plot_configs <- function(df) { label = paste("R-squared =", round(r_squared, 3)) ) ), - smooth = TRUE, - smooth_color = "tomato3", lm_line = list( intercept = intercept, - slope = slope + slope = slope, + color = "tomato3" ), shape = 3, size = 0.5,