Add rectangles to avg zscore plot

This commit is contained in:
2024-09-17 14:59:38 -04:00
parent d565f7f95f
commit 012c5e1d69

View File

@@ -800,10 +800,19 @@ generate_rank_plot_configs <- function(df_filtered, variables, is_lm = FALSE) {
x_var <- paste0("Avg_Zscore_", variable)
y_var <- paste0("Z_lm_", variable)
title_suffix <- paste("Avg Zscore vs lm", variable)
# Add rectangles configuration for Avg_Zscore_vs_lm
rectangles <- list(
list(
xmin = -2, xmax = 2, ymin = -2, ymax = 2,
fill = NA, color = "grey20", alpha = 0.1
)
)
} else {
x_var <- paste0(variable, "_Rank")
y_var <- paste0(variable, "_Rank_lm")
title_suffix <- paste("Rank Avg Zscore vs lm", variable)
rectangles <- NULL
}
# Fit linear model
@@ -839,7 +848,8 @@ generate_rank_plot_configs <- function(df_filtered, variables, is_lm = FALSE) {
legend_position = "right",
color_var = "Overlap",
x_label = x_var,
y_label = y_var
y_label = y_var,
rectangles = rectangles # Add rectangles configuration
)
}
}