Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Consistently use axs to refer to a set of Axes #14096

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
May 14, 2019

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Apr 29, 2019

PR Summary

Builds on top of #14079. You may wait with review until the above is in and I've rebased so that the changes are a bit smaller. Is merged.

The intention of this PR is described in the addition to pyplot.subplots() docstring:

Typical idioms for handling the return value are::

    # using the variable ax for single a Axes
    fig, ax = plt.subplots()

    # using the variable axs for multiple Axes
    fig, axs = plt.subplots(2, 2)

    # using tuple unpacking for multiple Axes
    fig, (ax1, ax2) = plt.subplot(1, 2)
    fig, ((ax1, ax2), (ax3, ax4)) = plt.subplot(2, 2)

The names ``ax`` and pluralized ``axs`` are preferred over ``axes``
because for the latter it's not clear if it refers to a single
`~.axes.Axes` instance or a collection of these.

Everything else in the commit is only applying this to examples and tests.

@timhoffm timhoffm force-pushed the subplots-axs branch 2 times, most recently from 5dba79d to 9bc34e8 Compare April 30, 2019 15:14

axes[1, 0].boxplot(data, meanprops=meanpointprops, meanline=False,
axs[1, 0].boxplot(data, meanprops=meanpointprops, meanline=False,
Copy link
Contributor

Choose a reason for hiding this comment

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

more alignment... (and below as well)
perhaps you can temporarily remove the flake8 rule excluding the check for these bad alignments to find all these cases locally :p

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Of course that was the last missing indent - well there are still lots, but not induced by this PR.

Copy link
Contributor

@anntzer anntzer left a comment

Choose a reason for hiding this comment

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

anyone can merge postci

@jklymak jklymak merged commit 8f6c598 into matplotlib:master May 14, 2019
@QuLogic QuLogic added this to the v3.2.0 milestone May 14, 2019
@timhoffm timhoffm deleted the subplots-axs branch May 14, 2019 19:34
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