From 19b6447eafc6dcf32630505ea12288764134a42f Mon Sep 17 00:00:00 2001 From: iamdoubz <> Date: Mon, 4 May 2026 09:13:30 -0500 Subject: [PATCH] Fix legend alpha display issue --- renderer.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/renderer.py b/renderer.py index 8be098d..81b44c1 100644 --- a/renderer.py +++ b/renderer.py @@ -142,12 +142,15 @@ def render_heatmap( rgba = _build_ekahau_rgba(grid, alpha) - _sm = ax.imshow( - grid, - extent=[0, w, 0, h], origin='upper', - cmap=SIGNAL_CMAP, vmin=VMIN, vmax=VMAX, - alpha=0, zorder=0, aspect='auto' - ) + # Use a standalone ScalarMappable to drive the colorbar. + # The hidden alpha=0 imshow blanks the colorbar on many backends + # because matplotlib treats a fully-transparent mappable as having + # no drawable content. A detached ScalarMappable with norm and cmap + # set explicitly is always rendered correctly. + _sm = plt.cm.ScalarMappable( + cmap=SIGNAL_CMAP, + norm=mcolors.Normalize(vmin=VMIN, vmax=VMAX)) + _sm.set_array([]) # required by matplotlib even when supplying no data ax.imshow( rgba,