Skip to content

MNT/DOC: Deprecate anchor in Axes3D.set_aspect #30408

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

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

Conversation

Aaratrika-Shelly
Copy link
Contributor

This PR closes #30364 .

PR summary

This PR cleans up the Axes3D.set_aspect method by deprecating the unused anchor parameter and clarifying the documentation for 3D-specific behavior.

  • Why is this change necessary? The method inherited the anchor and adjustable parameters from its 2D parent, but these are confusing and not applicable in a 3D context. This led to an inaccurate docstring.

  • What problem does it solve? It removes a confusing, non-functional parameter from the API and provides users with clear, accurate documentation for how set_aspect behaves on 3D axes.

  • What is the reasoning for this implementation?

    • A conditional warning is now raised inside the method if anchor is used, making the deprecation clear to users without breaking existing tests that rely on the default anchor=None.
    • The unnecessary super() call has been removed to simplify the logic, resolving a visual inconsistency found during testing.
    • The docstring has been minimally edited to accurately describe the behavior of the adjustable parameter and formally deprecate anchor.

A new unit test has been added to specifically verify the deprecation warning is raised correctly.

PR checklist

@Aaratrika-Shelly Aaratrika-Shelly force-pushed the fix/axes3d-set-aspect branch 2 times, most recently from 4e0dfa6 to 5088f5d Compare August 9, 2025 19:12
@Aaratrika-Shelly
Copy link
Contributor Author

Hello
All the CI checks have passed except for the Documentation build. It's failing with a WARNING: py:obj reference target not found: anchor.
I've double-checked the docstring formatting in axes3d.py on my branch, and the anchor parameter appears to be correctly wrapped in double backticks (anchor). I'm not sure why the build is still failing.
Is it possible there's a caching issue, or am I missing another detail? Any guidance on how to resolve this last check would be greatly appreciated!

@@ -244,7 +244,7 @@ def _transformed_cube(self, vals):
(minx, maxy, maxz)]
return proj3d._proj_points(xyzs, self.M)

def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
def set_aspect(self, aspect, adjustable=None, anchor=None):
Copy link
Member

Choose a reason for hiding this comment

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

Why did you delete share?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello! I removed the share parameter because it was only being passed to the super().set_aspect() call.
During local testing, I found that the super() call was causing an ImageComparisonFailure in the existing test_aspects test. Based on the original issue's suggestion and that test failure, I removed the super() call entirely. Since share was no longer being used anywhere inside the method, I removed it from the signature and docstring as well to clean up the unused code.
Please let me know if you think it should be handled differently

'SE' lower right corner
etc.
===== =====================
``adjustable`` : None or {'box', 'datalim'}, optional
Copy link
Member

Choose a reason for hiding this comment

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

Why is this code style now?

Comment on lines +267 to +268
This parameter is not used for 3D axes but is present for
compatibility with 2D axes. It will be ignored.
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem to be what the title of the PR / the related issue suggests; is it true?


share : bool, default: False
If ``True``, apply the settings to all shared Axes.
``anchor`` : None or str or 2-tuple of float, optional
Copy link
Member

Choose a reason for hiding this comment

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

Why is this changed to code style?

Copy link
Member

Choose a reason for hiding this comment

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

This should go in one of the existing files unless you definitely don't see one that matches, but it shouldn't have this name then.

If ``True``, apply the settings to all shared Axes.
``anchor`` : None or str or 2-tuple of float, optional
.. deprecated:: 3.11
The `anchor` parameter is not used for 3D axes and will be
Copy link
Member

Choose a reason for hiding this comment

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

You can't reference parameters.

Suggested change
The `anchor` parameter is not used for 3D axes and will be
The *anchor* parameter is not used for 3D axes and will be

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.

[MNT]/[DOC]: Look into Axes3D.set_aspect anchor and adjustable arguments
2 participants