Skip to content

add_subplot(..., axes_class=...) for more idiomatic mpl_toolkits usage. #18573

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
Sep 29, 2020

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 25, 2020

PR Summary

Implements #18548, see discussion there.

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


# axes for colorbar
ax_cb = Axes(fig, divider.get_position())
# (the label prevents Axes.add_axes from incorrectly believing that the two
Copy link
Contributor Author

@anntzer anntzer Sep 25, 2020

Choose a reason for hiding this comment

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

this is #10660, #9037, etc.

projection_class, extra_kwargs = projection._as_mpl_axes()
kwargs.update(**extra_kwargs)
"Cannot combine 'axes_class' and 'projection' or 'polar'")
projection_class = axes_class
Copy link
Member

Choose a reason for hiding this comment

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

You and I have crossing PRs, so its pretty important for my rebases that you have tests if possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry about that, added a test

Copy link
Member

Choose a reason for hiding this comment

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

This line still doesn't have a test according to codecov. I can probably be careful in my rebase, but....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hopefully better now

@anntzer anntzer force-pushed the axes_class branch 4 times, most recently from 9560d79 to cafdff1 Compare September 28, 2020 20:01
@anntzer
Copy link
Contributor Author

anntzer commented Sep 28, 2020

now with docs!

@@ -1129,6 +1138,10 @@ def add_axes(self, *args, **kwargs):
polar : bool, default: False
If True, equivalent to projection='polar'.

axes_class : subclass type of `~.axes.Axes`, optional
The `.axes.Axes` subclass that is instantiated. This parameter
is incompatible with *projection* and *polar*.
Copy link
Member

Choose a reason for hiding this comment

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

This is somewhat mysterious. Can we link to an example here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you want to pick one? :)

Copy link
Member

Choose a reason for hiding this comment

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

I dunno, which ever subclass gets used the most?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found the right thing to link.

@jklymak jklymak added this to the v3.4.0 milestone Sep 29, 2020
@jklymak jklymak merged commit c24de89 into matplotlib:master Sep 29, 2020
@anntzer anntzer deleted the axes_class branch September 29, 2020 19:24
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.

3 participants