Skip to content

Fix marker overlap - #15594

Closed
jakeprojects wants to merge 4 commits into
matplotlib:masterfrom
jakeprojects:fix-marker-overlap
Closed

jakeprojects wants to merge 4 commits into
matplotlib:masterfrom
jakeprojects:fix-marker-overlap

Conversation

@jakeprojects

@jakeprojects jakeprojects commented Nov 2, 2019 •

Copy link
Copy Markdown
Contributor

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

Comment thread lib/mpl_toolkits/mplot3d/art3d.py Resolved
@tacaswell tacaswell added this to the v3.3.0 milestone Nov 2, 2019
Comment thread lib/mpl_toolkits/mplot3d/art3d.py Resolved
Comment thread lib/mpl_toolkits/mplot3d/art3d.py Resolved
@QuLogic

QuLogic commented Mar 11, 2020

Copy link
Copy Markdown
Member

@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

timhoffm commented May 1, 2020

Copy link
Copy Markdown
Member

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

@QuLogic

QuLogic commented May 5, 2020

Copy link
Copy Markdown
Member

Not passing though...

@timhoffm timhoffm self-assigned this May 5, 2020
@timhoffm

timhoffm commented May 5, 2020

Copy link
Copy Markdown
Member

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

QuLogic commented May 6, 2020

Copy link
Copy Markdown
Member

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

timhoffm commented May 6, 2020

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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

timhoffm commented May 10, 2020 •

Copy link
Copy Markdown
Member

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

QuLogic commented May 11, 2020

Copy link
Copy Markdown
Member

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