Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Fix getting polar axes in plt.polar()#10674
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
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
umm, I'm not too up on the pyplot interface, but isgca()
necessarilly asubplot(111)
?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
OK, but I don't get the point of this PR then. Why is this better than whats there now? Is the idea to letplt.polar
write on an existing polar axes, despite the factgca
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The wholegca
situation 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 tosubplot
is being incorrectly applied togca
.
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.
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Great, I'll close this then.
Uh oh!
There was an error while loading.Please reload this page.
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.polar
will 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
.