Skip to content

Commit d47f836

Browse files
committed
bugfix: handle alpha correctly in colormapping with uint8
svn path=/trunk/matplotlib/; revision=8968
1 parent 13e4704 commit d47f836

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/colors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,8 @@ def __call__(self, X, alpha=None, bytes=False):
547547
if alpha is not None:
548548
alpha = min(alpha, 1.0) # alpha must be between 0 and 1
549549
alpha = max(alpha, 0.0)
550+
if bytes:
551+
alpha = int(alpha * 255)
550552
if (lut[-1] == 0).all():
551553
lut[:-1, -1] = alpha
552554
# All zeros is taken as a flag for the default bad

0 commit comments

Comments
 (0)