Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
API: Remove deprecated axes kwargs collision detection#18978
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
0f59282
to8540c04
CompareThe Travis failure seems to be unrelated. |
tacaswell commentedNov 21, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Well, it looks like the changes to the OSS version of travis have finally caught up with us Reading more carefully the failure was unrelated to our builds getting suspended, it was trying to get an image from the network. I still agree we can disregard that for reviewing this PR. |
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.
I am still a bit worried about this as changing how how axes are created seems like it should get extra consideration, however this has been warning from 2.1 which is more than fair warning.
Discussion on call convinced me we need a bit more thinking.
#12513 for other discussion. |
Consusensus on the call was that we can not break plt.subplot(222)plt.subplot(222) because as much as we think this is a bad idea (and holding onto the returned Axes object leads to significantly better code) there is no other way to "get back to" a previous axes using just the pyplot API. The logic for this re-use should fully live in |
jklymak commentedNov 24, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
EDIT: sorry cross post with above.... I've not looked at all the changes here carefully, but can try to do so. However, as discussed on the weekly call, we need to make sure ax0=plt.subplot(2,1,1)plt.subplot(2,1,2)ax1=subplot(2,1,1)assertax0==ax1 still works, preferably without warning.... We did discuss the extra arguments case and decided that ax0=plt.subplot(2,1,1,polar=True)plt.subplot(2,1,2)ax1=subplot(2,1,1,polar=False)# Warns about ignored kwargsassertax0==ax1# passax2=subplot(2,1,1,polar=True)# Warns about ignored kwargsassertax0==ax2# pass should both warn that the second and third call has kwargs that are being ignored, rather than trying to check if the kwargs match the creation kwargs they should just be ignored. This precludes users from getting two axes over one another using pure pyplot, but they can still do this via non-pyplot: ax0=fig.add_subplot(2,1,1,polar=True)ax1=fig.add_subplot(2,1,1,polar=False)# creates a *second* cartesian axes Note that in that case, Ping@tacaswell,@anntzer,@timhoffm in case I got any of that incorrect. |
In Matplotlib 2.1, the behavior of reusing existing axes whencreated with the same arguments was deprecated (seematplotlib#9037). Thisbehavior is now removed.Functions that create new axes (`axes`, `add_axes`, `subplot`, etc.)will now always create new axes, regardless of whether the kwargspassed to them match already existing axes.Passing kwargs to `gca` is deprecated. If `gca` is called withkwargs that do not match the current axes, then an exception israised.Fixesmatplotlib#18832.
8540c04
to41b93d8
Compare@tacaswell,@jklymak, I've attempted to implement that behavior, but I am getting some unit test failures related to twin axes, and I'm a bit stuck. Would you take a look, please? |
I now understand the problem with twin axes. The method To avoid this issue, is it OK if the logic for reusing an existing subplot livesonly in |
I think this PR was replaced by#19153. |
Uh oh!
There was an error while loading.Please reload this page.
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.
Functions that create new axes (
axes
,add_axes
,subplot
, etc.) will now always create new axes, regardless of whether the kwargs passed to them match already existing axes.Passing kwargs to
gca
is deprecated. Ifgca
is called with kwargs that do not match the current axes, then an exception is raised.Fixes#18832.
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).