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: round instead of truncate Agg canvas size#8265

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

Draft
tacaswell wants to merge6 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromtacaswell:fix_stable_pixel_size_rounding

Conversation

tacaswell
Copy link
Member

As suggested by@njsmith in#8253 round, rather than truncate the size in pixels of the Agg canvas. This fails two tests for me locally

  • test_boxarrow[0-boxarrow_test_image-png]
  • test_bbox_inches_tight_suptile_legend[0-bbox_inches_tight_suptile_legend-png]

iirc the second one is also unstable on travis. Do not have time to investigate further tonight, but regenerating two images seems like a small price to pay for making it more reliable to get renders of a fixed pixel size.

@tacaswelltacaswell added this to the2.0.1 (next bug fix release) milestoneMar 11, 2017
@@ -243,7 +243,7 @@ def get_renderer(self, cleared=None):
# Mirrors super.get_renderer, but caches the old one
# so that we can do things such as produce a diff image
# in get_diff_image
_, _, w, h = self.figure.bbox.bounds
_, _, w, h =np.round(self.figure.bbox.bounds).astype(int)
w, h = int(w), int(h)
Copy link
Member

Choose a reason for hiding this comment

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

This conversion to python int is not done in the other two backends, so presumably it is not needed here. (I see that numpy.int64 and int instances both hash to the corresponding python int.)

@tacaswelltacaswell modified the milestones:2.1 (next point release),2.0.1 (next bug fix release)Mar 11, 2017
@tacaswell
Copy link
MemberAuthor

I get one failure locally now:

bbox_inches_tight_suptile_legend-failed-diff

which is due to some text shifting vertically, not really sure what is going on here. The logic inside ofbbox_tight is a bit confusing and hacks at the inneards of the transform stack in interesting ways.

@ngoldbaum
Copy link
Contributor

FWIW, this doesn't fix the floating point round-off issues in the animation framework that#8253 resolves. I will try to make a simple test script to attach to that issue.

@efiring
Copy link
Member

@ngoldbaum, is it possible that using rounding consistently--here and in#8253, in place of int with the nextafter adjustment--would solve the problem?

@ngoldbaum
Copy link
Contributor

I don't know - all I tried was running my test yt script with this PR applied in my working copy. It failed, but it's possible there needs to be other code changes in the animation module.

@tacaswelltacaswell modified the milestones:2.1 (next point release),2.2 (next next feature release)Aug 29, 2017
@jklymak
Copy link
Member

Thanks for the PR. This hasn't seen action for a long time so marking stale. Note that PRs sometimes fall through the cracks, so if this is important, please ping for more reviews.

@tacaswelltacaswell mentioned this pull requestJun 5, 2020
@jklymakjklymak marked this pull request as draftSeptember 10, 2020 16:25
@tacaswelltacaswellforce-pushed thefix_stable_pixel_size_rounding branch from0324a6b to08a91cfCompareDecember 7, 2021 22:09
@tacaswelltacaswell modified the milestones:needs sorting,v3.6.0Dec 7, 2021
@tacaswelltacaswellforce-pushed thefix_stable_pixel_size_rounding branch 2 times, most recently from153b637 to98acc4fCompareDecember 7, 2021 22:48
@TangChiaHsinTangChiaHsin mentioned this pull requestApr 9, 2022
@QuLogicQuLogic modified the milestones:v3.6.0,v3.7.0Jul 5, 2022
This avoids marking the figure as stale un-necessarily.Also remove a local variable which is immediately replaced below.
The change to rounding made these images one pixel wider
When rasterizing the figure, the allowed sizes are discrete due to afinite dpi.  When getting the renderer (at which point we havecommitted to rasterizing the figure at this dpi) feedback the actualsize.
@tacaswell
Copy link
MemberAuthor

self.window.ClientToWindowSize(wx.Size(\nRuntimeError: wrapped C/C++ object of type FigureFrameWx has been deleted

This still needs some work and I think tweak around the short-circuit on the resize is not working quite right either.

@github-actions
Copy link

Since this Pull Request has not been updated in 60 days, it has been marked "inactive." This does not mean that it will be closed, though it may be moved to a "Draft" state. This helps maintainers prioritize their reviewing efforts. You can pick the PR back up anytime - please ping us if you need a review or guidance to move the PR forward! If you do not plan on continuing the work, please let us know so that we can either find someone to take the PR over, or close it.

@efiring
Copy link
Member

It seems past time for something like this to get in; let's keep it alive.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@efiringefiringefiring left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
backend: aggstatus: inactiveMarked by the “Stale” Github Actionstatus: needs rebase
Projects
None yet
Milestone
future releases
Development

Successfully merging this pull request may close these issues.

7 participants
@tacaswell@ngoldbaum@efiring@jklymak@QuLogic@ksunden@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp