Skip to content

Round pixel snapping to actual next pixel #7465

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 21, 2016

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Nov 16, 2016

This is hopefully a simpler alternative to #6776 (@mdboom). I don't fully understand why the rounding-to-next-pixel uses int(ceil(width + 1)); switching to int(ceil(width)) works just as well, though unlike #6776 (which only special-cases non-standard Axes), it does have an effect on our test images. An unfortunately large number of our test images are changed, though several of them for the better.

I split up the test images updates into definitely-good (images were originally outside the Axes by one pixel), probably-good (images were probably on the Axes frame, but aren't any longer) and I-have-no-idea (basically all the mlab plots, which do something really strange.)

@QuLogic QuLogic added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Nov 16, 2016
@QuLogic QuLogic added this to the 2.0 (style change major release) milestone Nov 16, 2016
I don't understand why there's a + 1 here, but it rounds up to the
next-next pixel instead of the next pixel. This makes images extend past
the end of the frame.

Fixes matplotlib#6773.
Fixes matplotlib#7350.
The pixel snapping in these images moved them outside the Axes frame, or
in such a way that doesn't quite align with the ticks.
I can't say for certain, but they don't look any worse. Probably the
last row/column was overlapping the Axes frame and was invisible before
now.
@QuLogic QuLogic force-pushed the pixel-snapping branch 2 times, most recently from bb05c12 to c8191a8 Compare November 17, 2016 07:18
@QuLogic
Copy link
Member Author

QuLogic commented Nov 18, 2016

Since this includes specgram tests that @tacaswell simplified greatly, ping @matthew-brett in case there are any issues with them on 32-bit systems.

Copy link
Contributor

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

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

Looking at the changes to the images, I certainly think the new ones look aligned/centered better than before.

The old code taking the ceiling then adding 1 also certainly seems suspect, so I'm good with this.

Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

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

The revised version looks correct to me.

@dopplershift dopplershift changed the title Round pixel snapping to actual next pixel [MRG+2] Round pixel snapping to actual next pixel Nov 21, 2016
@NelleV NelleV merged commit dc66735 into matplotlib:v2.x Nov 21, 2016
@QuLogic QuLogic deleted the pixel-snapping branch November 21, 2016 21:21
@QuLogic QuLogic changed the title [MRG+2] Round pixel snapping to actual next pixel Round pixel snapping to actual next pixel Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants