GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Snap markers to subpixels instead of whole ones by QuLogic · Pull Request #32108 · matplotlib/matplotlib Conversation
Member
PR summaryWe cache the marker for performance, but this causes it to look very pixel-grid aligned, especially if there are multiple in a regular pattern, or they are animated. Apply the same algorithm as mplcairo noted by @anntzer in #7233, specifically, render and cache the marker in n_subdiv levels in each direction, and pick the closest one for each marker. Fixes #7233 AI DisclosureNone PR checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
QuLogic
commented
Comment on lines
+501
to
+504
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mplcairo special-cases the pixel marker; I have not checked how that turns out or whether that is necessary.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC the idea is that not snapping the pixel marker results in it being smeared across two pixels, whereas it would otherwise look sharp (exactly one pixel filled) on a raster output.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Comment on lines
+532
to
+535
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100% certain we should be snapping here for each of the cached subpixel markers. It affects a lot more test images if we drop this though.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From a quick look mplcairo disables snapping when generating subpixel markers, which still makes sense to me? (Actually, if you snap, I don't see how you can benefit from subpixel positioning.) Maybe the issue with test images is with ticks, which are effectively markers and should indeed be drawn snapped? Can that be fixed by explicitly forcing snapping on them? (I didn't re-check snap control semantics, but maybe(?) it makes sense that if snapping is requested on the edges of a Line2D, then it is also enabled on the markers at its vertices?)
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
2 tasks done
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
Can we special-case TICKDOWN / TICKUP markers so that they keep their old behavior? IMHO mid-term, the implementation of ticks via Line2D with specific markers should become an implementation detail. But |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
In mplcairo ticks are not drawn with stamping at all but by drawing them one at a time, which IIRC is indeed needed to make them sharp and not blurry. Actually this is not an explicit switch but just the consequence of other choices: the size of the pattern cache (which is pre-populated prior to sampling) is normally between |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
We cache the marker for performance, but this causes it to look very pixel-grid aligned, especially if there are multiple in a regular pattern, or they are animated. Apply the same algorithm as mplcairo noted by @anntzer in matplotlib#7233, specifically, render and cache the marker in *n_subdiv* levels in each direction, and pick the closest one for each marker. Fixes matplotlib#7233
There was an error while loading. Please reload this page.
|
I've rebased and added the image changes for people to look at. I don't quite think we should keep them all, but I haven't looked into any additional special-casing besides the pixel marker (which needs to be optimized, probably.) There also seems to be some
Ah, I don't think I noticed that and didn't implement it. The downside of doing that is it then depends on how we draw ticks, and there is of course some hope that we can refactor enough to draw them as a collection in the future.
I thought of this one originally, but I'm not sure how easy it is, since the Agg rasterizer is re-used for both marker cache and the actual drawing, so we'd have to do some careful tracking of state if we switch between them. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Looking at the test failure in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The antialiasing looks really bad with squares in the animation, how does mplcairo do with it? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I see some moire for the squares, but I think that's from scaling down to fit the GitHub comment width. I'm not sure it's so bad at full size, but here is what mplcairo looks like: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ah, indeed the moire goes away when the video is blown up. But it's still a bit weird, the moire doesn't show up even downscaled with mplcairo? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A conceptual thought without having tested it in detail: There could also be a difference in visual preference between static and animated images. Static images may benefit more from sharp edges, whereas in animations a smooth movement can be more important. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
PathCollection (and therefore Scatter) points are badly placed since v1.4 inaccurate marker positioning inplot()
There was an error while loading. Please reload this page.