Update handling of sequence labels for plot#27767
Merged
QuLogic merged 1 commit intomatplotlib:mainfrom Feb 15, 2024
Merged
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
2368337 to
2d610df
Compare
This comment was marked as outdated.
This comment was marked as outdated.
2d610df to
be1ebc2
Compare
This comment was marked as outdated.
This comment was marked as outdated.
5a029d8 to
af43359
Compare
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.
Member
Merged
af43359 to
a1ef60c
Compare
Member
Author
|
Hid a bunch of comments because they discuss issues with |
timhoffm
approved these changes
Feb 15, 2024
| if cbook.is_scalar_or_string(label): | ||
| labels = [label] * n_datasets | ||
| else: | ||
| if len(label) != n_datasets: |
Member
There was a problem hiding this comment.
Optional but inverting the if branches is more readable:
Suggested change
| if len(label) != n_datasets: | |
| if len(label) == n_datasets: | |
| … |
- you remove the negation in the condition
- And the short and good-case branch comes first
Member
Author
There was a problem hiding this comment.
I'm a little sleepy but I think this if doesn't have an else.
Member
Author
There was a problem hiding this comment.
Oh, I think I get it. I can have a look this evening (on the wrong computer at the moment).
a1ef60c to
ffc7ab0
Compare
timhoffm
approved these changes
Feb 15, 2024
ksunden
approved these changes
Feb 15, 2024
Member
|
Anyone can merge on green CI |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR summary
Closes #27762.
plot(x, y, label=['foo'])where y is 1D now results in the legend label "foo" instead of "['foo']" (immediate change).plot(x, y, label=sequence)where y is 1D and sequence is not of length 1 is deprecated to error in future.PR checklist