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

Skip to content

Commit 9827d1f

Browse files
committed
Consistent handling of empty composite images
1 parent 7f2f375 commit 9827d1f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def composite_images(images, renderer, magnification=1.0):
102102
Bbox([[x, y], [x + data.shape[1], y + data.shape[0]]]))
103103

104104
if len(parts) == 0:
105-
return None, 0, 0
105+
return np.empty((0, 0, 4), dtype=np.uint8), 0, 0
106106

107107
bbox = Bbox.union(bboxes)
108108

@@ -149,7 +149,7 @@ def flush_images():
149149
elif len(image_group) > 1:
150150
data, l, b = composite_images(
151151
image_group, renderer, mag)
152-
if data is not None:
152+
if data.size != 0:
153153
gc = renderer.new_gc()
154154
gc.set_clip_rectangle(parent.bbox)
155155
gc.set_clip_path(parent.get_clip_path())

0 commit comments

Comments
 (0)