-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Equal area markers #16891
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
base: main
Are you sure you want to change the base?
Equal area markers #16891
Conversation
2a900e9
to
456a621
Compare
456a621
to
a622304
Compare
Can we use this PR to talk about the proposed API and the need for it? There are so many other issues and PRs that I am having trouble following what has been said where. I'd really appreciate a few examples as to what this new feature is supposed to look like to the end user, and a bit more discussion as to whether this is worth the complexity. It seems there is one use case where its "lets let the user normalize the unit size of markers given a limited set of options" all the way to "lets let the user arbitrarily transform markers using the full transform stack". Perhaps these are not incompatible, but it would be nice to see what this will look like by the end of all these PRs. Right now the only example I've seen in any of the PRs is the quite esoteric desire to lay out pies charts using |
@jklymak absolutely! Opened this PR to centralize discussion since, as you say, it was pretty fractured before. I'll let @ImportanceOfBeingErnest speak for the use cases for custom paths for a marker, but we already allow custom paths for markers, that is existing API. This PR is not about allowing custom markers, but allowing us to normalize markers so that they look perceptually uniform (#15703). Since we already allow custom markers, any marker normalization code has to be able to perform its duties when passed an arbitrary path. Thankfully, the formulas for the area/extents/etc of an arbitrary path are actually quite simple (thanks to the fact that our Is the issue that you don't see a use-case for custom markers? We'd have to remove existing 3.2.x API to get rid of them. (Although the changes in this PR would go in more or less as-is regardless). |
There is a section "Why is this useful?" in my PR #16773. |
a622304
to
1a9ca44
Compare
1a9ca44
to
f4ab8a2
Compare
Just found this issue and wanted to offer my encouragement. It looks like it's going to take substantial effort, but I think it would be a really big improvement. |
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. |
PR Summary
WIP. A proposal to resolve #15703.
In short, I propose adding one new parameter to
MarkerStyle.__init__
, and expanding the options currently available fornormalization
(copied from the proposed docstring ofMarkerStyle.__init__
):Goals
A "complete" custom marker system, that allows the user to choose between several options for marker normalization and centering as is most relevant to their particular plotting goals.
Implementation
The marker customization options will require the following new functionality
Path.get_exact_extents
(a bugfix of_path.get_extents
does not correctly handle bezier curves #16830, implemented in Correctly compute path extents #16832)Path.length
(Path length #16888)Path.signed_area
(Compute area of path #16859)Path.center_of_mass
(Path center of mass #16889)Any reasonable implementation of the above three methods will require
BezierSegment.arc_length
(Path length #16888)BezierSegment.arc_area
(Compute area of path #16859)BezierSegment.center_of_mass
(Path center of mass #16889)Each
Path
function will simply accumulate the values for itsBezierSegment
counterpart to compute the values for the total path (ourPath
's right now are simply collections ofBezierSegments
, even though they're not stored that way explicitly).Unfortunately, for methods of
Path
to call methods ofBezierSegment
, some slight re-arrangements are required to prevent circular import issues (#16812).Finally, in order to iterate easily over the
BezierSegment
's that make up the path (to do this accumulation), I'll need to implementPath.iter_bezier
(Bezier/Path API Cleanup: fix circular import issue #16812)Using
iter_segments
directly instead requires a HUGE amount repeated code. Incorporating the proposed.iter_bezier
functionality intoiter_segments
leads to an absolutely unwieldy amount of bloat initer_segments
, so the real question I think is just whether this should be added to the public API (it seems like a very good candidate to me, as it produces MUCH cleaner user code than usingiter_segments
for any code I've had to write, and presents a much more simple model of the underlyingPath
).Roadmap
#16812 (*) <- #16832 (*) <- #16859 (*) <- #16888 <- #16889 (*) <- (This PR)
"<-" means "depends on", and "(*)" marks PRs whose implementations are complete and fully ready for review.
PR Checklist