diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 0c50fa460d54..02ac47fbdf36 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -25,7 +25,7 @@ # the image namespace: from matplotlib._image import * -from matplotlib.transforms import BboxBase, Bbox +from matplotlib.transforms import BboxBase, Bbox, IdentityTransform import matplotlib.transforms as mtransforms @@ -270,8 +270,8 @@ def _draw_unsampled_image(self, renderer, gc): # firs, convert the image extent to the ic x_llc, x_trc, y_llc, y_trc = self.get_extent() - xy = trans.transform_non_affine(np.array([(x_llc, y_llc), - (x_trc, y_trc)])) + xy = trans.transform(np.array([(x_llc, y_llc), + (x_trc, y_trc)])) _xx1, _yy1 = xy[0] _xx2, _yy2 = xy[1] @@ -283,15 +283,16 @@ def _draw_unsampled_image(self, renderer, gc): if self._image_skew_coordinate: # skew the image when required. x_lrc, y_lrc = self._image_skew_coordinate - xy2 = trans.transform_non_affine(np.array([(x_lrc, y_lrc)])) + xy2 = trans.transform(np.array([(x_lrc, y_lrc)])) _xx3, _yy3 = xy2[0] tr_rotate_skew = self._get_rotate_and_skew_transform(_xx1, _yy1, _xx2, _yy2, _xx3, _yy3) - trans_ic_to_canvas = tr_rotate_skew+trans.get_affine() + trans_ic_to_canvas = tr_rotate_skew else: - trans_ic_to_canvas = trans.get_affine() + trans_ic_to_canvas = IdentityTransform() + # Now, viewLim in the ic. It can be rotated and can be # skewed. Make it big enough. diff --git a/lib/matplotlib/tests/baseline_images/test_image/image_shift.pdf b/lib/matplotlib/tests/baseline_images/test_image/image_shift.pdf new file mode 100644 index 000000000000..f9fdc183ae95 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_image/image_shift.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_image/image_shift.svg b/lib/matplotlib/tests/baseline_images/test_image/image_shift.svg new file mode 100644 index 000000000000..b04183aacb30 --- /dev/null +++ b/lib/matplotlib/tests/baseline_images/test_image/image_shift.svg @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index 4556013bc4cb..587fd94c5618 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -160,6 +160,21 @@ def test_no_interpolation_origin(): ax = fig.add_subplot(212) ax.imshow(np.arange(100).reshape((2, 50)), interpolation='none') +@image_comparison(baseline_images=['image_shift'], remove_text=True, + extensions=['pdf', 'svg']) +def test_image_shift(): + from matplotlib.colors import LogNorm + + imgData = [[1.0/(x) + 1.0/(y) for x in range(1,100)] for y in range(1,100)] + tMin=734717.945208 + tMax=734717.946366 + + fig = plt.figure() + ax = fig.add_subplot(111) + ax.imshow(imgData, norm=LogNorm(), interpolation='none', + extent=(tMin, tMax, 1, 100)) + ax.set_aspect('auto') + if __name__=='__main__': import nose nose.runmodule(argv=['-s','--with-doctest'], exit=False)