Skip to content

Sort 3d sizes along with other properties - #18136

Merged
jkseppan merged 1 commit into
matplotlib:masterfrom
tomneep:mplot3d_scatter_sizes
Aug 2, 2020
Merged

jkseppan merged 1 commit into
matplotlib:masterfrom
tomneep:mplot3d_scatter_sizes

Conversation

@tomneep

@tomneep tomneep commented Jul 31, 2020 •

Copy link
Copy Markdown
Contributor

PR Summary

Fixes #18135. The sizes of the points need to be updated when reordering along with the other properties.

scatter3d_fixed

PR Checklist

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

@WeatherGod

Copy link
Copy Markdown
Member

This seems to be the right solution, but this is going to need a test. You can use the demo code in the original issue as the basis for the test.

@timhoffm timhoffm added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Jul 31, 2020
@timhoffm timhoffm added this to the v3.3.1 milestone Jul 31, 2020
@timhoffm

Copy link
Copy Markdown
Member

Targeting for 3.3.1 as release critical, because it's a regression in 3.3.0 introduced via #17378.

@tomneep

tomneep commented Jul 31, 2020

Copy link
Copy Markdown
Contributor Author

Added a test. Maybe plotting 100 points was overkill thinking about it. Let me know if you want me to reduce the number of points.

Pre-fix

old

Post-fix

new

@timhoffm timhoffm left a comment

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.

Maybe plotting 100 points was overkill thinking about it. Let me know if you want me to reduce the number of points.

That does not affect the drawing time significantly, so IMHO it's ok.

@WeatherGod

Copy link
Copy Markdown
Member

This looks pretty good. Quick question for the peanut gallery. Technically speaking, a Poly3DCollection is probably also impacted by this bug because it derives from PolyCollection, which derives from _CollectionWithSizes. Don't know of any real use-case though of specifying sizes for poly3d collections, though (or if it even works?).

@QuLogic

QuLogic commented Jul 31, 2020

Copy link
Copy Markdown
Member

Is an image test really required here? Can you not pull the sizes from the produced collection, or is this re-ordering draw-dependent?

If that's not possible, then I think we can still use a figure comparison test instead. Just compare with a plot using individual scatter calls.

@tomneep

tomneep commented Jul 31, 2020

Copy link
Copy Markdown
Contributor Author

@QuLogic The reordering is draw dependant so I couldn't get a standard test to work using get_sizes. I took your advice and changed to a figure comparison test with individual scatter calls.

@tacaswell

tacaswell commented Aug 1, 2020 •

Copy link
Copy Markdown
Member

@tomneep Can you squash this to one commit (or we can squash-merge it)? As it is the image will still be in the history (and we are trying to keep the repo from getting even bigger than it already is).

@QuLogic QuLogic left a comment

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.

Modulo rebase, or we can squash.

@tomneep

tomneep commented Aug 1, 2020

Copy link
Copy Markdown
Contributor Author

@tacaswell Makes sense. I've rebased and squashed into a single commit.

@jkseppan
jkseppan merged commit 164e650 into matplotlib:master Aug 2, 2020
@jkseppan

jkseppan commented Aug 2, 2020

Copy link
Copy Markdown
Member

Thanks @tomneep!

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 2, 2020
timhoffm added a commit that referenced this pull request Aug 2, 2020
…136-on-v3.3.x

Backport PR #18136 on branch v3.3.x (Sort 3d sizes along with other properties)
@tomneep
tomneep deleted the mplot3d_scatter_sizes branch August 19, 2021 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Point size array in the Axes3D scatter() does not follow the same order as in the data points

6 participants