Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cba27cd

Browse files
committed
Fix potential issue with np.float16
1 parent 0578147 commit cba27cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/colors.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,9 @@ def __call__(self, X, alpha=None, bytes=False):
516516
# masked values are substituted below; no need to fill them here
517517

518518
if xa.dtype.char in np.typecodes['Float']:
519-
cbook._putmask(xa, xa==1.0, 0.9999999) #Treat 1.0 as slightly less than 1.
519+
# Treat 1.0 as slightly less than 1.
520+
cbook._putmask(xa, xa==1.0, np.nextafter(xa.dtype.type(1),
521+
xa.dtype.type(0)))
520522
# The following clip is fast, and prevents possible
521523
# conversion of large positive values to negative integers.
522524

0 commit comments

Comments
 (0)