Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf6340d4

Browse files
committed
BUG: fix normalizing image data contained in np.ndarray subclass
1 parent09eab5b commitf6340d4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

‎lib/matplotlib/image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,12 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
461461
vmid=np.float64(self.norm.vmin)+dv/2
462462
fact=1e7ifscaled_dtype==np.float64else1e4
463463
newmin=vmid-dv*fact
464-
ifnewmin<a_min:
464+
ifnewmin<np.float64(a_min):
465465
newmin=None
466466
else:
467467
a_min=np.float64(newmin)
468468
newmax=vmid+dv*fact
469-
ifnewmax>a_max:
469+
ifnewmax>np.float64(a_max):
470470
newmax=None
471471
else:
472472
a_max=np.float64(newmax)

‎lib/matplotlib/transforms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2853,15 +2853,15 @@ def nonsingular(vmin, vmax, expander=0.001, tiny=1e-15, increasing=True):
28532853
if (notnp.isfinite(vmin))or (notnp.isfinite(vmax)):
28542854
return-expander,expander
28552855

2856+
# Expand vmin, vmax to float: if they were integer types, they can wrap
2857+
# around in abs (abs(np.int8(-128)) == -128) and vmax - vmin can overflow.
2858+
vmin,vmax=map(np.float64, (vmin,vmax))
2859+
28562860
swapped=False
28572861
ifvmax<vmin:
28582862
vmin,vmax=vmax,vmin
28592863
swapped=True
28602864

2861-
# Expand vmin, vmax to float: if they were integer types, they can wrap
2862-
# around in abs (abs(np.int8(-128)) == -128) and vmax - vmin can overflow.
2863-
vmin,vmax=map(float, [vmin,vmax])
2864-
28652865
maxabsvalue=max(abs(vmin),abs(vmax))
28662866
ifmaxabsvalue< (1e6/tiny)*np.finfo(float).tiny:
28672867
vmin=-expander

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp