-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Cleanup pyplot.axes() #9930
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
Cleanup pyplot.axes() #9930
Conversation
This is related to the deprecation, as of 2.1, of accepting an existing Axes argument in Figure.add_axes. The deprecation warning can be added to the docstring here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just a couple of small typos to fix.
lib/matplotlib/pyplot.py
Outdated
* :file:`examples/pylab_examples/axes_demo.py` places custom axes. | ||
* :file:`examples/pylab_examples/shared_axis_demo.py` uses | ||
*sharex* and *sharey*. | ||
Add an axes to the current figure and makes it the current axes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Add an axes" --> "Adds an axes"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other way around: "makes" -> "make"
lib/matplotlib/pyplot.py
Outdated
|
||
>>> plt.axes() | ||
|
||
Creating a new axes with specified dimensions and somw kwargs:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"somw" --> "some"
lib/matplotlib/pyplot.py
Outdated
- 4-tuple of floats *rect* = ``[left, bottom, width, height]``. | ||
A new axes is added with dimensions *rect* in normalized | ||
(0, 1) units using `~.Figure.add_axes` on the current figure. | ||
- `~.Axes`: The is is equivalent to `.pyplot.sca`. It sets the current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The is is -> This is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of the bullets should match the initial spec
lib/matplotlib/pyplot.py
Outdated
|
||
Other Parameters | ||
---------------- | ||
kwargs : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**kwargs
ad58045
to
5c58245
Compare
@efiring IMO it's a bit different. If I read correctly, the deprecation in I'm speaking of deprecating Axes as a possible parameter type in |
If I understand correctly, that'd be a breaking change, and would at least need a deprecation period. Shouldn't hold this PR up though... |
+1 to deprecation |
I've created a separate issue #9940 for the proposed deprecation. So this can be handled separately from the above changes. |
Thanks @timhoffm ! |
PR Summary
In continuation of #9912, this cleans up the code and docstring of
pyplot.axes()
.The changes so far are fully API-compatible.
However, I propose to deprecate the use with an
Axes
object as argument. This use-case is just a call tosca()
. First,sca(ax)
should be preferred overaxes(ax)
for clarity and the one obvious way. Second, this use ofaxes
has a total diffent semanics.axes()
creates a new Axes on the current figure. Whereasaxes(ax)
just makes the given axes current. As a side effect this may even change the current figure.PR Checklist
there)