diff --git a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R index 46eb3d6a..5e655397 100644 --- a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R +++ b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R @@ -418,17 +418,18 @@ generate_and_save_plots <- function(output_dir, file_name, plot_configs, grid_la plot # default case if no type matches ) - return(plot) + return(list(plot = plot, config = config)) }) # PDF saving logic pdf(file.path(output_dir, paste0(file_name, ".pdf")), width = 14, height = 9) - lapply(plots, print) + lapply(plots, function(item) print(item$plot)) dev.off() - + # HTML saving logic - plotly_plots <- lapply(plots, function(plot) { - config <- plot$config + plotly_plots <- lapply(plots, function(item) { + plot <- item$plot + config <- item$config if (!is.null(config$legend_position) && config$legend_position == "bottom") { suppressWarnings(ggplotly(plot, tooltip = "text") %>% layout(legend = list(orientation = "h"))) } else { @@ -605,6 +606,7 @@ generate_interaction_plot_configs <- function(df, variables) { ) annotations <- lapply(names(annotation_positions[[variable]]), function(annotation_name) { + message("Processing annotation: ", annotation_name, " for variable: ", variable) y_pos <- annotation_positions[[variable]][[annotation_name]] # Check if the annotation_name exists in annotation_labels