Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Update handling of sequence labels for plot#27767
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
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Hid a bunch of comments because they discuss issues with |
lib/matplotlib/axes/_base.py Outdated
if cbook.is_scalar_or_string(label): | ||
labels = [label] * n_datasets | ||
else: | ||
if len(label) != n_datasets: |
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.
Optional but inverting the if branches is more readable:
iflen(label)!=n_datasets: | |
iflen(label)==n_datasets: | |
… |
- you remove the negation in the condition
- And the short and good-case branch comes first
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'm a little sleepy but I think thisif
doesn't have anelse
.
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.
Oh, I think I get it. I can have a look this evening (on the wrong computer at the moment).
Anyone can merge on green CI |
Uh oh!
There was an error while loading.Please reload this page.
PR summary
Closes#27762.
plot(x, y, label=['foo'])
wherey is 1D now results in the legend label "foo" instead of "['foo']" (immediate change).plot(x, y, label=sequence)
wherey is 1D andsequence is not of length 1 is deprecated to error in future.PR checklist