Skip to content

Fix #6773: Don't do image extent adjustment... #6776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import matplotlib.colors as mcolors
import matplotlib.cm as cm
import matplotlib.cbook as cbook
from matplotlib import patches as mpatches

# For clarity, names from _image are given explicitly in this module:
import matplotlib._image as _image
Expand Down Expand Up @@ -299,6 +300,8 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
`trans` is the affine transformation from the image to pixel
space.
"""
from matplotlib import axes as maxes

if A is None:
raise RuntimeError('You must first set the image'
' array or the image attribute')
Expand Down Expand Up @@ -336,11 +339,15 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
-clipped_bbox.y0)
.scale(magnification, magnification))

# So that the image is aligned with the edge of the axes, we want
# 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 and
# So that the image is aligned with the edge of the axes, we
# want to round up the output width to the next integer. This
# also means scaling the transform just slightly to account
# for the extra subpixel. This is only required for regular
# rectangular axes where the edges are pixel-snapped. For
# non-rectangular axes, this refinement isn't required.
if (round_to_pixel_border and
t.is_affine and
isinstance(self.axes, mpatches.Rectangle) and
(out_width_base % 1.0 != 0.0 or
out_height_base % 1.0 != 0.0)):
out_width = int(ceil(out_width_base) + 1)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.