Skip to content

Commit

Permalink
Fix matplotlib#5520: Don't round up if already rounded
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom committed Jan 5, 2016
1 parent 4233358 commit fe84a80
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/matplotlib/image.py
Expand Up @@ -273,7 +273,9 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
# to round up the output width to the next integer. This also
# means scaling the transform just slightly to account for the
# extra subpixel.
if t.is_affine and round_to_pixel_border:
if (t.is_affine and round_to_pixel_border and
(out_width_base % 1.0 != 0.0 or
out_height_base % 1.0 != 0.0)):
out_width = int(ceil(out_width_base) + 1)
out_height = int(ceil(out_height_base) + 1)
extra_width = (out_width - out_width_base) / out_width_base
Expand Down

0 comments on commit fe84a80

Please sign in to comment.