Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix marker overlap #15594

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

Closed

Conversation

jakeprojects
Copy link
Contributor

@jakeprojects jakeprojects commented Nov 2, 2019

PR Summary

Performance optimization of sorting by z co-ordinates for scatter plots of Path3DCollection objects. Locally observed a 20x speed-up using this approach, unit tests test_mplot3d.py passed. Initially forked from xenoryt.

Reuses #10791 with performance optimization.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell added this to the v3.3.0 milestone Nov 2, 2019
@QuLogic
Copy link
Member

QuLogic commented Mar 11, 2020

@jakeprojects are you still interested in finishing this?

xenoryt and others added 3 commits May 1, 2020 20:39
Sort points by z coordinate values similar to Poly3DCollection

Added: Image comparison tests for marker overlap

Fix PEP8 errors

Refactored do_projection to use starred expression
@timhoffm timhoffm force-pushed the fix-marker-overlap branch from e4b75a1 to 7cd8c4a Compare May 1, 2020 18:41
@timhoffm
Copy link
Member

timhoffm commented May 1, 2020

I took the liberty to fix the minor comments above and rebase on master.

@QuLogic
Copy link
Member

QuLogic commented May 5, 2020

Not passing though...

@timhoffm timhoffm self-assigned this May 5, 2020
@timhoffm
Copy link
Member

timhoffm commented May 5, 2020

Tests were broken because the test and reference images appeared to have a different magnification (or layout margin). Not sure if we changed anything in this respect.

Anyway, I've exchanged the image comparisons with figure comparison tests checking:

  1. The data point order does not influence which marker is drawn on top.
  2. Rotating the view by 180° and exchanging the colors should give the original image.

Commits should be squashed before merging to remove the test images from the earlier commits. I didn't want to force push a squash on another user's repo and remove part of the test code without approval.

@QuLogic
Copy link
Member

QuLogic commented May 6, 2020

I'd rather they be rebased out instead of squashing, because the commits are written by different authors since this was taken up from a previous PR. I have not checked yet if the new test is okay though.

@timhoffm
Copy link
Member

timhoffm commented May 6, 2020

Not sure how that rebase should work. The first commit contains the image tests and part of the relevant code. Do you wish to strip the tests from that commit?

I think the best is to squash everything into one commit because we do not need the back-and-forth of the development history here. We can credit all the authors for the commit.

vys = vys[z_markers_idx]
fcs = fcs[z_markers_idx]
ecs = ecs[z_markers_idx]
vps = np.vstack((vxs, vys)).T
Copy link
Member

Choose a reason for hiding this comment

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

Why change to vstack.T instead of column_stack?

Copy link
Member

Choose a reason for hiding this comment

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

Both are fine. I've changed to column_stack, which seems a bit clearer.

Interestingly, vstack.T is marginally faster for > 10k elements:
grafik
But 10ms difference is not the end of the world also for 1e6 elements. Probably all the surrounding code is much slower anyway.

@timhoffm timhoffm mentioned this pull request May 10, 2020
@timhoffm
Copy link
Member

timhoffm commented May 10, 2020

Please merge #17378 instead: Same code but commits squashed and images stripped. (I didn't want to push the squash to another user's repo, so I had to open a separate PR. All three contributors are credited.

@QuLogic
Copy link
Member

QuLogic commented May 11, 2020

Closing in favour of the above squashed PR.

@QuLogic QuLogic closed this May 11, 2020
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.

7 participants