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

Skip to content

Commit 08e98da

Browse files
committed
Use kind instead of issubclass
1 parent a86b4d4 commit 08e98da

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/matplotlib/backends/backend_agg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def post_processing(image, dpi):
403403
img, ox, oy = post_processing(img.reshape((h, w, 4)) / 255.,
404404
self.dpi)
405405
gc = self.new_gc()
406-
if issubclass(img.dtype.type, np.floating):
406+
if img.dtype.kind == 'f':
407407
img = np.asarray(img * 255., np.uint8)
408408
img = img[::-1]
409409
self._renderer.draw_image(

lib/matplotlib/cm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def to_rgba(self, x, alpha=None, bytes=False, norm=True):
263263
rgba = self.cmap(x, alpha=alpha, bytes=bytes)
264264
# For floating-point greyscale images, we treat negative as
265265
# transparent so we copy that over to the alpha channel
266-
if x.ndim == 2 and issubclass(x.dtype.type, np.floating):
266+
if x.ndim == 2 and x.dtype.kind == 'f':
267267
rgba[:, :, 3] = np.where(x < 0.0, 0, rgba[:, :, 3])
268268
return rgba
269269

lib/matplotlib/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
287287
if not unsampled:
288288
if len(A.shape) == 2:
289289
A = self.norm(A)
290-
if issubclass(A.dtype.type, np.floating):
290+
if A.dtype.kind == 'f':
291291
# For floating-point greyscale images, we treat negative
292292
# numbers as transparent.
293293
output = np.empty((out_height, out_width), dtype=A.dtype)

0 commit comments

Comments
 (0)