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

Skip to content

Commit 8d53a8a

Browse files
committed
FIX: image respect norm limits w/ None
1 parent 89c3345 commit 8d53a8a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/matplotlib/image.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,12 +394,13 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
394394
dv = (np.float64(self.norm.vmax) -
395395
np.float64(self.norm.vmin))
396396
vmid = self.norm.vmin + dv / 2
397-
newmin = vmid - dv * 1.e7
397+
fact = 1e7 if scaled_dtype == np.float64 else 1e4
398+
newmin = vmid - dv * fact
398399
if newmin < a_min:
399400
newmin = None
400401
else:
401402
a_min = np.float64(newmin)
402-
newmax = vmid + dv * 1.e7
403+
newmax = vmid + dv * fact
403404
if newmax > a_max:
404405
newmax = None
405406
else:
@@ -409,7 +410,7 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
409410

410411
A_scaled -= a_min
411412
# a_min and a_max might be ndarray subclasses so use
412-
# asscalar to ensure they are scalars to avoid errors
413+
# asscalar to avoid errors
413414
a_min = np.asscalar(a_min.astype(scaled_dtype))
414415
a_max = np.asscalar(a_max.astype(scaled_dtype))
415416

0 commit comments

Comments
 (0)