changeset 272:3ee426f114d6 draft

Uploaded
author luca_milaz
date Sun, 04 Aug 2024 16:47:47 +0000
parents d879c594013d
children b193805e19b1
files marea_2/flux_to_map.py
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/marea_2/flux_to_map.py	Sun Aug 04 16:41:12 2024 +0000
+++ b/marea_2/flux_to_map.py	Sun Aug 04 16:47:47 2024 +0000
@@ -821,9 +821,17 @@
 def gray_to_red_cmap(value):
     """Map a normalized value to RGB color transitioning from gray to red."""
     value = abs(value)
-    r = 0.5 + 0.5 * value
-    g = 0.5 - 0.5 * value
-    b = 0.5 - 0.5 * value
+    if value < 0.5:
+        # Transition from blue to gray
+        r = 0.5 * value * 2
+        g = 0.5 * value * 2
+        b = 1
+    else:
+        # Transition from gray to red
+        value = (value - 0.5) * 2
+        r = 1
+        g = 1 - value
+        b = 1 - value
     
     return (r, g, b)
 
@@ -866,14 +874,14 @@
 
         for rxn_id in ids:
             arrow = Arrow(width=5, col=colors_median[rxn_id])
-            arrow.applyTo(arrow.getMapReactionId(rxn_id, mindReactionDir=True), metabMap_median, arrow.toStyleStr())
+            arrow.applyTo(arrow.getMapReactionId(rxn_id, mindReactionDir=False), metabMap_median, arrow.toStyleStr())
             # Now we style the arrow head(s):
             idOpt1, idOpt2 = getArrowHeadElementId(arrow.getMapReactionId(rxn_id, mindReactionDir=True))
             arrow.applyTo(idOpt1, metabMap_median, arrow.toStyleStr(downSizedForTips = True))
             if idOpt2: arrow.applyTo(idOpt2, metabMap_median, arrow.toStyleStr(downSizedForTips = True))
 
             arrow = Arrow(width=5, col=colors_mean[rxn_id])
-            arrow.applyTo(arrow.getMapReactionId(rxn_id, mindReactionDir=True), metabMap_mean, arrow.toStyleStr())
+            arrow.applyTo(arrow.getMapReactionId(rxn_id, mindReactionDir=False), metabMap_mean, arrow.toStyleStr())
             # Now we style the arrow head(s):
             idOpt1, idOpt2 = getArrowHeadElementId(arrow.getMapReactionId(rxn_id, mindReactionDir=True))
             arrow.applyTo(idOpt1, metabMap_mean, arrow.toStyleStr(downSizedForTips = True))