Skip to content

Make Axis3D constructor signature closer to the one of 2D axis. #21425

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

Merged
merged 1 commit into from
Mar 23, 2022

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Oct 21, 2021

Setting adir to a direction not matching the specific axis class
doesn't make sense anyways; the viewlims and datalims properties
previously got init'ed to their preexisting values; and init3d doesn't
warrant being a separate public API.

Also deprecate the 3D-specific d_interval and v_interval attributes, as
they have direct replacements compatible with 2D.

PR Summary

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

Comment on lines 131 to 134
if "d_intervalx" in params:
self.d_interval = params["d_intervalx"]
if "v_intervalx" in params:
self.v_interval = params["v_intervalx"]
Copy link
Member

Choose a reason for hiding this comment

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

Are either of these used for anything? Maybe they should be deprecated as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are not used, but let's deprecate them some other time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually they have direct replacements, so I deprecated them.

@timhoffm
Copy link
Member

Do we expect external users of the API and if so, end users or other libs?

In case of other libs, we should be more cautious because that warning will propagate to their users, who cannot do anything about it. The correct way then would be a pending depredcation warning to give downstream libs time to adapt.

@anntzer
Copy link
Contributor Author

anntzer commented Oct 24, 2021

I don't expect anyone to use these APIs externally, but of course one never knows...
OTOH this doesn't seem different from any other deprecations we do; is there a specific reason you want to go slower on this one?

@timhoffm
Copy link
Member

I'm generally a bit concerned on the rate of deprecations. We don't want to become a library that users have to adapt to on every release. Most deprecations have either a very clear benefit or are quite unlikely to affect users.
Instantiating an Axis explicitly is rare - I'd assume if that is used it'll be only some clever code in a downstream lib. So the improvement isn't visible for many users. But if a downstream package uses the constructor, all users will get warnings. That was my main concern.

@anntzer
Copy link
Contributor Author

anntzer commented Oct 24, 2021

I switched to pending deprecations.
While it is in theory possible for third parties to instantiate 3D axises themselves, they would have needed to perform quite a song and dance to make useful use of them, so I would guess that it is rare.

@timhoffm
Copy link
Member

If others are more confident than me, you might also merge with a non-pending deprecation. 😄

@anntzer
Copy link
Contributor Author

anntzer commented Oct 24, 2021

I'm not really in a hurry either.

Setting `adir` to a direction not matching the specific axis class
doesn't make sense anyways; the viewlims and datalims properties
previously got init'ed to their preexisting values; and init3d doesn't
warrant being a separate public API.

Also deprecate the 3D-specific d_interval and v_interval attributes, as
they have direct replacements compatible with 2D.
@tacaswell tacaswell merged commit 11737d0 into matplotlib:main Mar 23, 2022
@anntzer anntzer deleted the a3 branch March 23, 2022 07:11
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