Skip to content

MNT: Restore auto-adding Axes3D to their parent figure on init #19496

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 3 commits into from
Feb 18, 2021

Conversation

tacaswell
Copy link
Member

@tacaswell tacaswell commented Feb 11, 2021

Only do this when directly created by the user, not via our machinery.

PR Summary

Alternative to #19413.

This still needs tests and updates to the docs.

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).

@tacaswell tacaswell added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Feb 11, 2021
@tacaswell tacaswell added this to the v3.4.0 milestone Feb 11, 2021
@jklymak
Copy link
Member

jklymak commented Feb 11, 2021

This passes the labelled test if you go back to the old way of calling:

@mpl3d_image_comparison(['axes3d_labelpad.png'], remove_text=False)
def test_axes3d_labelpad():
    fig = plt.figure()
    ax = Axes3D(fig)

OTOH, I was hoping we would deprecate calling Axes3D this way because it really is illogical to have it behave differently from every other type of axes.

@tacaswell tacaswell marked this pull request as ready for review February 17, 2021 21:26
@tacaswell
Copy link
Member Author

I ended up going with @jklymak 's approach of a public facing kwarg (to give users a migration path), but did it via kwarg-popping so it does not show up in the signature.

I think this is a lighter touch than #19413.

tacaswell and others added 2 commits February 17, 2021 23:06
Only warn when directly created by the user, not via our machinery.

Closes matplotlib#18939

Co-authored-by: Jody Klymak <jklymak@gmail.com>
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
@tacaswell
Copy link
Member Author

I think I fixed the doc build (by updating a very old whats new example!).

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.

3 participants