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

FIX: don't round image sizes to pixel if meant to be unsampled#25704

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
ksunden merged 1 commit intomatplotlib:mainfromjklymak:fix-dont-round-unsampled
Apr 25, 2023

Conversation

jklymak
Copy link
Member

@jklymakjklymak commentedApr 17, 2023
edited
Loading

Closes#8981

PR Summary

For images we do some pixel rounding, but if we are doing unsampled images (egimshow(..., interpolation='none')) and saving to a backend that allows rasters (svg, pdf), then we don't want to do the pixel rounding - that just makes the image sizes fractionally too large when that isn't needed at all if we don't resample.

All the test images that changed just model my a pixel, and all haveimshow(..., interpolation='none').

Old

Old

New

New

code

importnumpyasnpimportmatplotlib.pyplotaspltfig,ax=plt.subplots()ax.plot([0,0,1,1,0], [0,1,1,0,0],color='r',lw=0.1)np.random.seed(19680801)ax.imshow(np.random.randn(16,16),cmap='Blues',extent=(0,1,0,1),interpolation='none',vmin=-1,vmax=1)ax.set_xlim(-0.1,1+0.1)ax.set_ylim(-0.1,1+0.1)

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (andpytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a.. versionadded:: directive in the docstring and documented indoc/users/next_whats_new/
  • API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

@jklymakjklymakforce-pushed thefix-dont-round-unsampled branch fromeadeb74 to6704bffCompareApril 17, 2023 04:39
@jklymakjklymak marked this pull request as ready for reviewApril 17, 2023 04:40
@jklymakjklymak added this to thev3.8.0 milestoneApr 17, 2023
Copy link
Member

@oscargusoscargus left a comment
edited
Loading

Choose a reason for hiding this comment

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

I haven't checked, but maybe make sure that all of the now modified images havestyle='mpl20'?

@jklymak
Copy link
MemberAuthor

I think for review send posterity it probably makes sense to leave the images in the style they are already in? It's pretty easy to see they are only trivially changed whereas if we changed the colormaps they would change a lot. I think the style changes are minimal for these ones anyway - just colormaps for instance. While I appreciate there are those who hate jet, it's probably OK for testing 😀

@oscargus
Copy link
Member

Yes, it for sure make sense during the review to use the same style. Was more thinking of the overall goal from#24716

@jklymak
Copy link
MemberAuthor

Hopefully it will be moot when@tacaswell finishes his procedure for keeping track of image changes

@ksundenksunden merged commit139c045 intomatplotlib:mainApr 25, 2023
@QuLogic
Copy link
Member

@meeseeksdev backport to v3.7.x

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestJun 28, 2023
@QuLogicQuLogic modified the milestones:v3.8.0,v3.7.2Jun 28, 2023
QuLogic added a commit that referenced this pull requestJun 29, 2023
…704-on-v3.7.xBackport PR#25704 on branch v3.7.x (FIX: don't round image sizes to pixel if meant to be unsampled)
@jklymakjklymak deleted the fix-dont-round-unsampled branchMarch 22, 2024 16:13
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ksundenksundenksunden approved these changes

@oscargusoscargusoscargus approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.7.2
Development

Successfully merging this pull request may close these issues.

Incorrect imshow extent in PDF backend
4 participants
@jklymak@oscargus@QuLogic@ksunden

[8]ページ先頭

©2009-2025 Movatter.jp