Skip to content

Make zdir key-word only for 3D-scatter and -bar #27538

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

oscargus
Copy link
Member

@oscargus oscargus commented Dec 18, 2023

PR summary

Related to #27287 and #27368. Putting it here to see the consequences on examples etc and to discuss if it makes sense. Will naturally add release notes.

(As far as I can see, zdir is not tested at all for scatter. bar only has a single test which passes zdir as a kwarg.)

PR checklist

@oscargus oscargus changed the title Make zdir key-word only Make zdir key-word only for 3D-scatter and -bar Dec 18, 2023
@QuLogic
Copy link
Member

QuLogic commented Dec 20, 2023

It seems okay, other than the missing tests?

@oscargus
Copy link
Member Author

It seems okay, other than the missing tests?

Missing tests as in tests to see that it actually warns or tests for zdir? The first will be there, the second I tried but couldn't really understand how it was supposed to work, so seems bad to add a test when one isn't convinced that it works as expected...

@@ -2653,7 +2653,7 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,
if np.may_share_memory(zs_orig, zs): # Avoid unnecessary copies.
zs = zs.copy()

patches = super().scatter(xs, ys, s=s, c=c, *args, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and below at super.bar(), are we sure that the super class method can't use any *args? Don't want to break any plots that rely on it if so.

Copy link
Member

Choose a reason for hiding this comment

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

In theory yes: https://matplotlib.org/devdocs/api/_as_gen/matplotlib.axes.Axes.scatter.html#matplotlib.axes.Axes.scatter

but very unlikely in practice. One would have to pass all 3D positional parameters

scatter(self, xs, ys, zs, zdir, s, c, depthshade, ...)

and then continue with the non-overlapping 2D positional parameters, minimally:

scatter(self, xs, ys, zs, zdir, s, c, depthshade, marker)

I would be very surprised if somebody took the effort to figure that out.

I'm inclined to allow tolerate minimal breakage here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Works for me!

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.

4 participants