Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

the affine matrix is calculated in the display coordinate for interpolation='none'#1150

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mdboom merged 3 commits intomatplotlib:masterfromleejjoon:fix-image-shift
Sep 5, 2012
Merged
Show file tree
Hide file tree
Changes fromall 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
13 changes: 7 additions & 6 deletionslib/matplotlib/image.py
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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
View file
Open in desktop
Binary file not shown.
206 changes: 206 additions & 0 deletionslib/matplotlib/tests/baseline_images/test_image/image_shift.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletionslib/matplotlib/tests/test_image.py
View file
Open in desktop
Original file line numberDiff line numberDiff 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)

[8]ページ先頭

©2009-2025 Movatter.jp