Skip to content

Commit 5af94d2

Browse files
committed
mend
Add tests for flatten kwarg and fix (h, w) consistency
1 parent 3ce7e5e commit 5af94d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/backends/backend_agg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def print_raw(self, filename_or_obj, *args, **kwargs):
514514
# Flatten RGBA if used with fileformat that doesn't handle trnasparency
515515
if kwargs.get('flatten', False):
516516
w, h = int(renderer.width), int(renderer.height)
517-
img = np.array(memoryview(img)).reshape((w, h, 4))
517+
img = np.array(memoryview(img)).reshape((h, w, 4))
518518
img = mimage.flatten_rgba(img)
519519

520520
try:
@@ -581,7 +581,7 @@ def print_jpg(self, filename_or_obj, *args, **kwargs):
581581
should be stored as a progressive JPEG file.
582582
"""
583583
buf, (w, h) = self.print_to_buffer()
584-
buf = np.array(memoryview(buf)).reshape((w, h, 4))
584+
buf = np.array(memoryview(buf)).reshape((h, w, 4))
585585

586586
if kwargs.pop("dryrun", False):
587587
return

0 commit comments

Comments
 (0)