Skip to content

Make Path3DCollection store indexed offset, and only apply z-ordered offset during draw #24491

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 1 commit into from
Nov 20, 2022

Conversation

hukaidong
Copy link
Contributor

@hukaidong hukaidong commented Nov 17, 2022

PR Summary

This PR is targeted to resolve issue #23155 by maintain offset order for indexing purpose. And z-ordered offset will only be applied during rendering peroid.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [N/A] New plotting related features are documented with examples.

Release Notes

  • [N/A] New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • [N/A] API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • [N/A] Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@hukaidong
Copy link
Contributor Author

@tacaswell would you mind checking this?

@tacaswell
Copy link
Member

This looks reasonable, but had a few comments. Good use of a context manager.

Could you please also add a test as well?

@tacaswell tacaswell added this to the v3.7.0 milestone Nov 18, 2022
@tacaswell
Copy link
Member

Could you compare this approach to #18932 and why you think this is a better path @hukaidong ?

@hukaidong
Copy link
Contributor Author

This looks reasonable, but had a few comments. Good use of a context manager.

Could you please also add a test as well?

Thanks, this does make sense. I'll append a test soon.

@hukaidong
Copy link
Contributor Author

Could you compare this approach to #18932 and why you think this is a better path @hukaidong ?

I see quite amount of refraction tries to reduce the amount of method provided in artists class, which is not relevant to this topic. So I put them apart. For the work refractoring do_3d_projection, it saves space from storing offset with a cost re-computing projection transform twice. One in do_3d_projection in order to compute the over-all z order in the Axes#draw method. The other in Collection#Draw to get the projection. So, I'd like to say storing an extra offset and swap during drawing time will be cheaper.

@hukaidong
Copy link
Contributor Author

@tacaswell I'm not sure if this is the best way to test the issue but I've added a test case there. Also a null guard is set in context manager so we won't have to worry about AttributeError.

@hukaidong hukaidong requested a review from tacaswell November 18, 2022 23:21
@hukaidong
Copy link
Contributor Author

This looks reasonable, but had a few comments. Good use of a context manager.
Could you please also add a test as well?

Thanks, this does make sense. I'll append a test soon.

And also, in case, I've checked main branch and new test case failed there as excepted.

@hukaidong
Copy link
Contributor Author

@tacaswell Looks I'm not able to do the merge. Who should I call for the merging?

@ksunden ksunden merged commit 8c3736f into matplotlib:main Nov 20, 2022
@ksunden
Copy link
Member

ksunden commented Nov 20, 2022

@hukaidong just FYI, we do require two approving reviews from core contributors before merging (for changes to library code) which is why @tacaswell did not previously merge this when he first approved it

@hukaidong
Copy link
Contributor Author

@hukaidong just FYI, we do require two approving reviews from core contributors before merging (for changes to library code) which is why @tacaswell did not previously merge this when he first approved it

Awesome! Thanks for letting me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants