Skip to content

Commit 8b0df6a

Browse files
committed
Round image dimensions to actual next pixel.
I don't understand why there's a + 1 here, but it rounds up to the next-next pixel instead of the next pixel. This makes images extend past the end of the frame. Fixes #6773. Fixes #7350.
1 parent 59c9f36 commit 8b0df6a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/matplotlib/image.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,9 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
341341
# means scaling the transform just slightly to account for the
342342
# extra subpixel.
343343
if (t.is_affine and round_to_pixel_border and
344-
(out_width_base % 1.0 != 0.0 or
345-
out_height_base % 1.0 != 0.0)):
346-
out_width = int(ceil(out_width_base) + 1)
347-
out_height = int(ceil(out_height_base) + 1)
344+
(out_width_base % 1.0 != 0.0 or out_height_base % 1.0 != 0.0)):
345+
out_width = int(ceil(out_width_base))
346+
out_height = int(ceil(out_height_base))
348347
extra_width = (out_width - out_width_base) / out_width_base
349348
extra_height = (out_height - out_height_base) / out_height_base
350349
t += Affine2D().scale(

0 commit comments

Comments
 (0)