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

Commit1384c7c

Browse files
committed
Use transforms to rotate image, not hack
1 parent0793aa2 commit1384c7c

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

‎examples/api/demo_affine_image.py‎

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,15 @@ def get_image():
2424
returnZ
2525

2626

27-
defimshow_affine(ax,z,*kl,**kwargs):
28-
im=ax.imshow(z,*kl,**kwargs)
29-
x1,x2,y1,y2=im.get_extent()
30-
im._image_skew_coordinate= (x2,y1)
31-
returnim
32-
33-
3427
if1:
3528

3629
# image rotation
3730

38-
fig,(ax1,ax2)=plt.subplots(1,2)
31+
fig,ax1=plt.subplots(1,1)
3932
Z=get_image()
40-
im1=imshow_affine(ax1,Z,interpolation='none',
41-
origin='lower',
42-
extent=[-2,4,-3,2],clip_on=True)
33+
im1=ax1.imshow(Z,interpolation='none',
34+
origin='lower',
35+
extent=[-2,4,-3,2],clip_on=True)
4336

4437
trans_data2=mtransforms.Affine2D().rotate_deg(30)+ax1.transData
4538
im1.set_transform(trans_data2)
@@ -53,13 +46,3 @@ def imshow_affine(ax, z, *kl, **kwargs):
5346

5447
ax1.set_xlim(-3,5)
5548
ax1.set_ylim(-4,4)
56-
57-
# image skew
58-
59-
im2=ax2.imshow(Z,interpolation='none',
60-
origin='lower',
61-
extent=[-2,4,-3,2],clip_on=True)
62-
im2._image_skew_coordinate= (3,-2)
63-
64-
plt.show()
65-
#plt.savefig("demo_affine_image")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp