Fix legend alpha display issue
This commit is contained in:
1 parent
7befa142a6
commit
19b6447eaf
1 file changed
+9
-6
+9
-6
@@ -142,12 +142,15 @@ def render_heatmap(
|
|||||||
|
|
||||||
rgba = _build_ekahau_rgba(grid, alpha)
|
rgba = _build_ekahau_rgba(grid, alpha)
|
||||||
|
|
||||||
_sm = ax.imshow(
|
# Use a standalone ScalarMappable to drive the colorbar.
|
||||||
grid,
|
# The hidden alpha=0 imshow blanks the colorbar on many backends
|
||||||
extent=[0, w, 0, h], origin='upper',
|
# because matplotlib treats a fully-transparent mappable as having
|
||||||
cmap=SIGNAL_CMAP, vmin=VMIN, vmax=VMAX,
|
# no drawable content. A detached ScalarMappable with norm and cmap
|
||||||
alpha=0, zorder=0, aspect='auto'
|
# 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(
|
ax.imshow(
|
||||||
rgba,
|
rgba,
|
||||||
|
|||||||
Reference in new issue
Block a user