Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Raises ValueError on unequal lengths of labels and handles input#24063

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

Closed
grgkaran03 wants to merge5 commits intomatplotlib:mainfromgrgkaran03:kg-feature

Conversation

grgkaran03
Copy link
Contributor

@grgkaran03grgkaran03 commentedOct 1, 2022
edited
Loading

…_args

PR Summary

Verifying that the inputs are of a consistent length in _parse_legend_args.
Number of elements in handles and labels should be equal, addressing the issue#24050 .

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@grgkaran03
Copy link
ContributorAuthor

@QuLogic, please review the changes...
Also, how do I overcome these failing tests?

@oscargus
Copy link
Member

The failing tests are not related to your PR. However, your PR would need a test that checks that the exception is raised. This should probably go intohttps://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/tests/test_legend.py

Here is a similar test to see how to check for an exception:

deftest_legend_positional_handles_only(self):
lines=plt.plot(range(10))
withpytest.raises(TypeError,match='but found an Artist'):
# a single arg is interpreted as labels
# it's a common error to just pass handles
plt.legend(lines)

(Also, note that#24061 solves the same issue.)

@jklymak
Copy link
Member

I'll close this as a duplicate. We can reopen if the other PR does not go through. Feel free to contribute to the ongoing PR

tusharkulkarni008 reacted with thumbs up emoji

@jklymakjklymak closed thisOct 1, 2022
@grgkaran03
Copy link
ContributorAuthor

@jklymak I tried adding a test for raising a ValueError, do open this if the other one does not go through 👍

tusharkulkarni008 reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@grgkaran03@oscargus@jklymak

[8]ページ先頭

©2009-2025 Movatter.jp