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

Skip to content

Commit 94c6304

Browse files
committed
Simplified conditions
1 parent 10139d1 commit 94c6304

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/matplotlib/image.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,12 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
363363
if inp_dtype.kind == 'f':
364364
scaled_dtype = A.dtype
365365
# Cast to float64
366-
if A.dtype not in (np.float32, np.float16):
367-
if A.dtype != np.float64:
368-
warnings.warn(
369-
"Casting input data from '{0}' to 'float64'"
370-
"for imshow".format(A.dtype))
366+
# It is important to set scaled_dtype to be float64 even
367+
# if it already scaled_dtype == float64 (on some
368+
# platforms).
369+
if A.dtype not in (np.float64, np.float32, np.float16):
370+
warnings.warn("Casting input data from '{0}' to"
371+
"'float64' for imshow".format(A.dtype))
371372
scaled_dtype = np.float64
372373
else:
373374
# probably an integer of some type.

0 commit comments

Comments
 (0)