Fix getting polar axes in plt.polar()#10674
Fix getting polar axes in plt.polar()#10674dstansby wants to merge 2 commits intomatplotlib:masterfrom
Conversation
| "warning can be suppressed, and the future behavior " | ||
| "ensured, by passing a unique label to each axes " | ||
| "instance.") | ||
| "instance.\n" |
There was a problem hiding this comment.
Also added some newlines here to make the warning more readable.
| ax = gca(polar=True) | ||
| ax = gca() | ||
| else: | ||
| ax = gcf().add_subplot(1, 1, 1, polar=True) |
There was a problem hiding this comment.
umm, I'm not too up on the pyplot interface, but is gca() necessarilly a subplot(111)?
There was a problem hiding this comment.
No, but: If there are axes, use the gca(). If not, make a new one equivalent to subplot(111).
There was a problem hiding this comment.
OK, but I don't get the point of this PR then. Why is this better than whats there now? Is the idea to let plt.polar write on an existing polar axes, despite the fact gca will create a new axes in the future? That doesn't seem right. Sorry if I'm being dense...
There was a problem hiding this comment.
The whole gcasituation is incredibly confusing. I can't make sense of the current behavior and docstrings, and the warning about future behavior makes no sense to me either. gca means "get current axes"; it should not mean "always get a new axes". I think that the coming change to subplot is being incorrectly applied to gca.
There was a problem hiding this comment.
I agree that the warning in #10660 is wrong. I need to rethink about the correct way to ultimately get rid of the axes collision behavior.
There was a problem hiding this comment.
Great, I'll close this then.
Currently
ax = gca(polar=True)raises a warning, because in future version it will return a new subplot instead of returning an existing one.This PR removes this warning, and ensures
plt.polarwill behave well into the future by callinggca()without arguments. This means that if no axes are present, a new polar axes is manually created inplt.polar.