Преглед изворни кода

Fix discrete x_var mapping

Bryan Roessler пре 6 месеци
родитељ
комит
462d6070bd
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      qhtcp-workflow/apps/r/calculate_interaction_zscores.R

+ 5 - 2
qhtcp-workflow/apps/r/calculate_interaction_zscores.R

@@ -608,7 +608,8 @@ generate_scatter_plot <- function(plot, config) {
 
   # Customize X-axis if specified
   if (!is.null(config$x_breaks) && !is.null(config$x_labels) && !is.null(config$x_label)) {
-    if (is.factor(df[[config$x_var]]) || is.character(df[[config$x_var]])) {
+    # Check if x_var is factor or character (for discrete x-axis)
+    if (is.factor(plot$data[[config$x_var]]) || is.character(plot$data[[config$x_var]])) {
       plot <- plot +
         scale_x_discrete(
           name = config$x_label,
@@ -624,6 +625,7 @@ generate_scatter_plot <- function(plot, config) {
         )
     }
   }
+
   
   # Set Y-axis limits if specified
   if (!is.null(config$ylim_vals)) {
@@ -656,7 +658,8 @@ generate_boxplot <- function(plot, config) {
 
   # Customize X-axis if specified
   if (!is.null(config$x_breaks) && !is.null(config$x_labels) && !is.null(config$x_label)) {
-    if (is.factor(df[[config$x_var]]) || is.character(df[[config$x_var]])) {
+    # Check if x_var is factor or character (for discrete x-axis)
+    if (is.factor(plot$data[[config$x_var]]) || is.character(plot$data[[config$x_var]])) {
       plot <- plot +
         scale_x_discrete(
           name = config$x_label,