changeset 320:fbda3a0cc8b1 draft

Uploaded
author luca_milaz
date Mon, 05 Aug 2024 13:05:27 +0000
parents a07405bcd3f3
children afaa7bcc730e
files marea_2/flux_to_map.py
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/marea_2/flux_to_map.py	Mon Aug 05 12:54:17 2024 +0000
+++ b/marea_2/flux_to_map.py	Mon Aug 05 13:05:27 2024 +0000
@@ -869,7 +869,7 @@
 
     # Add min and max value annotations
     ax.text(0, 0.5, f'{np.round(min_value, 3)}', va='center', ha='right', transform=ax.transAxes, fontsize=12, color='black')
-    ax.text(1, 0.5, f'{np.round(min_value, 3)}', va='center', ha='left', transform=ax.transAxes, fontsize=12, color='black')
+    ax.text(1, 0.5, f'{np.round(max_value, 3)}', va='center', ha='left', transform=ax.transAxes, fontsize=12, color='black')
 
 
     # Display the gradient image
@@ -924,8 +924,15 @@
 
     for key in class_pat:
         # Create color mappings for median and mean
-        colors_median = {rxn_id: rgb_to_hex(cmap(abs(medians[key][i]))) for i, rxn_id in enumerate(ids)}
-        colors_mean = {rxn_id: rgb_to_hex(cmap(abs(means[key][i]))) for i, rxn_id in enumerate(ids)}
+        colors_median = {
+            rxn_id: rgb_to_hex(cmap(abs(np.round(medians[key][i], 6)))) if medians[key][i] != 0 else '#bebebe'  #grey blocked
+            for i, rxn_id in enumerate(ids)
+        }
+
+        colors_mean = {
+            rxn_id: rgb_to_hex(cmap(abs(np.round(means[key][i], 6)))) if means[key][i] != 0 else '#bebebe'  #grey blocked
+            for i, rxn_id in enumerate(ids)
+        }
 
         for i, rxn_id in enumerate(ids):
             isNegative = medians[key][i] < 0
@@ -933,6 +940,7 @@
             # Apply median arrows
             apply_arrow(metabMap_median, rxn_id, colors_median[rxn_id], isNegative)
 
+            isNegative = means[key][i] < 0
             # Apply mean arrows
             apply_arrow(metabMap_mean, rxn_id, colors_mean[rxn_id], isNegative)