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

Docstring fix & small adjustements indemo_affine_image#6673

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

Closed

Conversation

afvincent
Copy link
Contributor

1/ Makes the red rectangle announced in the docstring red in the plot. The docstring has also been precised a bit.

2/ I think the comment about the image rotation was misplaced so I moved it where it seemed relevant to me.

3/ Finally, I've made the line width of the rectangle a bit bigger to be more visible and added a call toplt.show()

The example should now looks like:
modified_demo_affine_image

Remark 1: the colormap is notviridis because the colormap seems to default tognuplot2 in my conda env. I guess I had tweaked sthg and didn't remember it.

Remark 2: the red rectangle does not seem to be perfectly centered on the image: the 2 upper sides are mostly over the image, while the 2 lower sides are mostly out of it. Is it expected?

@afvincentafvincent changed the titleDocstring fix & small adjustementsDocstring fix & small adjustements indemo_affine_imageJul 1, 2016
fig, ax1 = plt.subplots(1, 1)
Z = get_image()
im1 = ax1.imshow(Z, interpolation='none',
origin='lower',
extent=[-2, 4, -3, 2], clip_on=True)

# image rotation
trans_data2 = mtransforms.Affine2D().rotate_deg(30) + ax1.transData
im1.set_transform(trans_data2)

# display intended extent of the image
x1, x2, y1, y2 = im1.get_extent()
x3, y3 = x2, y1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Are these used for anything?

@tacaswelltacaswell added this to the2.0.1 (next bug fix release) milestoneJul 2, 2016
@tacaswell
Copy link
Member

The offset between the image and rectangle does seem a bit odd...

@afvincent
Copy link
ContributorAuthor

@QuLogic You're right, and I didn't pay attention enough: x3 and y3 weren't used anywhere. I also removed the import ofmatplotlib.cm that was also not used.

I had an idea during the night and significantly modified the example to also show the image extent in the case where the affine transform is not applied. I've factorize the plotting of the extent rectangle and added some segment markers. However, the latters might be a bit overkill if one doesn't add a translation to the affine transorm (currently it's only a rotation).

The commit2f263b5 produces:
modified_demo_affine_image_v1

@tacaswell I'll try to investigate the possible issue of the offset between the image and the rectangle (I guess I'll have to learn about the details of Affine2D first…).

@afvincent
Copy link
ContributorAuthor

PR#6792 is not only aboutdemo_affine_image but as it has replicated the docstring fixes and will provide an extended demo of the affine transformations that may be more relevant than my changes, I think it should supersede the current PR. So I'm going to close this one. Please reopen it if anyone thinks it was a mistake.

@QuLogicQuLogic modified the milestones:unassigned,2.0.1 (next bug fix release)Aug 8, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@afvincent@tacaswell@QuLogic@mdboom

[8]ページ先頭

©2009-2025 Movatter.jp