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

Add consistency check for PathCollection sizes and edgecolors (#28833)#30138

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

Open
BrunoWolf03 wants to merge3 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromBrunoWolf03:main

Conversation

BrunoWolf03
Copy link

This pull request addresses issue#28833 by adding a consistency check inPathCollection.

The newcheck_consistency() method emits aUserWarning if the number ofsizes oredgecolors
does not match the number ofpaths. This method is called during thedraw() call to catch any
inconsistencies before rendering.

A test (test_pathcollection_size_mismatch_warning) is included to validate the warning behavior.

==================================================================

…tlib#28833)This patch adds a check_consistency() method to PathCollection,which emits a warning if the number of sizes or edgecolors does notmatch the number of paths. The check is invoked during the draw()call to ensure it happens after all data is set.Also adds a unit test that triggers the warning for mismatched sizes.
Copy link
Member

@rcomerrcomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you for the potential contribution. I think for now the main aim of the issue is to decide what we want to happen, so there is no guarantee this will get merged even if it works perfectly.

UserWarning: Number of sizes does not match number of paths.
"""
n_paths = len(self.get_paths())
if self._sizes is not None and len(self._sizes) not in (1, n_paths):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
ifself._sizesisnotNoneandlen(self._sizes)notin (1,n_paths):
ifself._sizes.sizenotin (0,1,n_paths):

Looking at theset_sizes method, we always end up with an array here, though it may be size zero (if None was passed). I think this is the cause of at least some of the failing tests (any warnings are translated into errors in the tests).

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@rcomerrcomerrcomer left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[MNT]: Data size consistency checks in _CollectionsWithSizes
2 participants
@BrunoWolf03@rcomer

[8]ページ先頭

©2009-2025 Movatter.jp