FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

the affine matrix is calculated in the display coordinate for interpolation='none' by leejjoon · Pull Request #1150 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .pdf  (1) .py  (2) .svg  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
13 changes: 7 additions & 6 deletions lib/matplotlib/image.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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]
Expand All @@ -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.
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
15 changes: 15 additions & 0 deletions lib/matplotlib/tests/test_image.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Back | FazBrowse Home | New Git URL