changeset 318:75454fbbb893 draft

Uploaded
author luca_milaz
date Mon, 05 Aug 2024 12:47:40 +0000
parents e7abca5fb51c
children a07405bcd3f3
files marea_2/flux_to_map.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/marea_2/flux_to_map.py	Mon Aug 05 12:43:57 2024 +0000
+++ b/marea_2/flux_to_map.py	Mon Aug 05 12:47:40 2024 +0000
@@ -844,7 +844,7 @@
     rgb = (np.array(rgb) * 255).astype(int)
     return '#{:02x}{:02x}{:02x}'.format(rgb[0], rgb[1], rgb[2])
 
-def save_colormap_image(min_value: float, max_value: float, path: str):
+def save_colormap_image(min_value: float, max_value: float, path: utils.FilePath):
     """
     Create and save an image of the colormap showing the gradient and its range.
 
@@ -862,9 +862,14 @@
     fig.subplots_adjust(bottom=0.5)
 
     # Create a gradient image
-    gradient = np.linspace(min_value, max_value, 256)
+    gradient = np.linspace(0, 1, 256)
     gradient = np.vstack((gradient, gradient))
 
+    # Add min and max value annotations
+    ax.text(0, 0.5, f'{min_value}', va='center', ha='right', transform=ax.transAxes, fontsize=12, color='black')
+    ax.text(1, 0.5, f'{max_value}', va='center', ha='left', transform=ax.transAxes, fontsize=12, color='black')
+
+
     # Display the gradient image
     ax.imshow(gradient, aspect='auto', cmap=cmap)
     ax.set_axis_off()