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

Skip to content

Commit 96ac546

Browse files
committed
for interpolation='none', the affine matrix is calculated in the display coordinate
1 parent 0ee82be commit 96ac546

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/matplotlib/image.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# the image namespace:
2626
from matplotlib._image import *
2727

28-
from matplotlib.transforms import BboxBase, Bbox
28+
from matplotlib.transforms import BboxBase, Bbox, IdentityTransform
2929
import matplotlib.transforms as mtransforms
3030

3131

@@ -270,8 +270,8 @@ def _draw_unsampled_image(self, renderer, gc):
270270
# firs, convert the image extent to the ic
271271
x_llc, x_trc, y_llc, y_trc = self.get_extent()
272272

273-
xy = trans.transform_non_affine(np.array([(x_llc, y_llc),
274-
(x_trc, y_trc)]))
273+
xy = trans.transform(np.array([(x_llc, y_llc),
274+
(x_trc, y_trc)]))
275275

276276
_xx1, _yy1 = xy[0]
277277
_xx2, _yy2 = xy[1]
@@ -283,15 +283,16 @@ def _draw_unsampled_image(self, renderer, gc):
283283
if self._image_skew_coordinate:
284284
# skew the image when required.
285285
x_lrc, y_lrc = self._image_skew_coordinate
286-
xy2 = trans.transform_non_affine(np.array([(x_lrc, y_lrc)]))
286+
xy2 = trans.transform(np.array([(x_lrc, y_lrc)]))
287287
_xx3, _yy3 = xy2[0]
288288

289289
tr_rotate_skew = self._get_rotate_and_skew_transform(_xx1, _yy1,
290290
_xx2, _yy2,
291291
_xx3, _yy3)
292-
trans_ic_to_canvas = tr_rotate_skew+trans.get_affine()
292+
trans_ic_to_canvas = tr_rotate_skew
293293
else:
294-
trans_ic_to_canvas = trans.get_affine()
294+
trans_ic_to_canvas = IdentityTransform()
295+
295296

296297
# Now, viewLim in the ic. It can be rotated and can be
297298
# skewed. Make it big enough.

0 commit comments

Comments
 (0)