瀏覽代碼

Simplify y-limits

Bryan Roessler 7 月之前
父節點
當前提交
c42e13d09f
共有 1 個文件被更改,包括 7 次插入11 次删除
  1. 7 11
      qhtcp-workflow/apps/r/calculate_interaction_zscores.R

+ 7 - 11
qhtcp-workflow/apps/r/calculate_interaction_zscores.R

@@ -664,18 +664,14 @@ generate_interaction_plot_configs <- function(df, variables) {
 
   configs <- list()
 
-  limits_map <- list(
-    L = c(-65, 65),
-    K = c(-65, 65),
-    r = c(-0.65, 0.65),
-    AUC = c(-6500, 6500)
-  )
-
-  # Filtering out NAs and outlying values
+  # Set the y-limits for each variable
   df_filtered <- df %>%
-    filter(across(names(limits_map),
-      ~ !is.na(.x) &
-      between(.x, limits_map[[.names]][1], limits_map[[.names]][2])))
+    filter(
+      !is.na(L) & between(L, -65, 65),
+      !is.na(K) & between(K, -65, 65),
+      !is.na(r) & between(r, -0.65, 0.65),
+      !is.na(AUC) & between(AUC, -6500, 6500)
+    )
 
   # Define annotation label functions
   generate_annotation_labels <- function(df, var, annotation_name) {