| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
This new behaviour sounds right to me, but have you tested it all? ie. I do not see a test that we create new axes, but maybe I read too quickly. |
Sorry, something went wrong.
|
@jklymak, I did not add any new unit tests. I only modified existing unit tests so that they would pass. |
Sorry, something went wrong.
|
Hi, any feedback on this PR? This is just a gentle poke because the submission was badly timed, right before the holidays. Thank you! |
Sorry, something went wrong.
|
Please do keep pinging us! OTOH, the ball is still in your court to add new tests for the new behaviour ;-) |
Sorry, something went wrong.
|
@jklymak, as requested, I added a unit test. |
Sorry, something went wrong.
Thanks a lot, the unit tests really make the new behaviour clear. This all seems reasonable to me, but lets ping @tacaswell, @timhoffm and @QuLogic to make sure we have all that was discussed in #18978 correct. |
Sorry, something went wrong.
|
@timhoffm, thank you, I addressed all of your comments. |
Sorry, something went wrong.
|
@QuLogic, I believe that I addressed all of your comments. |
Sorry, something went wrong.
|
It looks like you'll need to update the tests for the wording changes. |
Sorry, something went wrong.
In Matplotlib 2.1, the behavior of reusing existing axes when created with the same arguments was deprecated (see matplotlib#9037). This behavior is now removed. The behavior of the functions to create new axes (`pyplot.axes`, `pyplot.subplot`, `figure.Figure.add_axes`, `figure.Figure.add_subplot`) has changed. In the past, these functions would detect if you were attempting to create Axes with the same keyword arguments as already-existing axes in the current figure, and if so, they would return the existing Axes. Now, these functions will always create new Axes. A special exception is `pyplot.subplot`, which will reuse any existing subplot with a matching subplot spec. However, if there is a subplot with a matching subplot spec, then that subplot will be returned, even if the keyword arguments with which it was created differ. Correspondingly, the behavior of the functions to get the current Axes (`pyplot.gca`, `figure.Figure.gca`) has changed. In the past, these functions accepted keyword arguments. If the keyword arguments matched an already-existing Axes, then that Axes would be returned, otherwise new Axes would be created with those keyword arguments. Now, the keyword arguments are only considered if there are no axes at all in the current figure. In a future release, these functions will not accept keyword arguments at all. Fixes matplotlib#18832.
Whoops! Should be fixed now. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This replaces #18978, and addresses the comments from @tacaswell and @jklymak to preserve the behavior of repeated calls to plt.subplot with the same subplot spec.
PR Summary
In Matplotlib 2.1, the behavior of reusing existing axes when created with the same arguments was deprecated (see #9037). This behavior is now removed.
The behavior of the functions to create new axes (pyplot.axes, pyplot.subplot, figure.Figure.add_axes, figure.Figure.add_subplot) has changed. In the past, these functions would detect if you were attempting to create Axes with the same keyword arguments as already-existing axes in the current figure, and if so, they would return the existing Axes. Now, these functions will always create new Axes. A special exception is pyplot.subplot, which will reuse any existing subplot with a matching subplot spec. However, if there is a subplot with a matching subplot spec, then that subplot will be returned, even if the keyword arguments with which it was created differ.
Correspondingly, the behavior of the functions to get the current Axes (pyplot.gca, figure.Figure.gca) has changed. In the past, these functions accepted keyword arguments. If the keyword arguments matched an already-existing Axes, then that Axes would be returned, otherwise new Axes would be created with those keyword arguments. Now, the keyword arguments are only considered if there are no axes at all in the current figure. In a future release, these functions will not accept keyword arguments at all.
Fixes #18832.
PR Checklist