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

Skip to content

Commit ac0c85a

Browse files
committed
Fix float normalization too (float32->float32).
1 parent 1a2c4b0 commit ac0c85a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/colors.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,9 @@ def process_value(value):
884884
if is_scalar:
885885
value = [value]
886886
dtype = np.min_scalar_type(value)
887-
dtype = (np.float32 if dtype.itemsize <= 2
888-
else np.promote_types(dtype, float))
887+
if np.issubdtype(dtype, np.integer) or dtype.type is np.bool_:
888+
# bool_/int8/int16 -> float32; int32/int64 -> float64
889+
dtype = np.promote_types(dtype, np.float32)
889890
result = np.ma.array(value, dtype=dtype, copy=True)
890891
return result, is_scalar
891892

0 commit comments

Comments
 (0)