Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

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
/shapPublic
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

Fix/check for attribute to extract colors#4017

Conversation

fabianliebig
Copy link
Contributor

Overview

Adds further checks to avoid AttributeError.

Thebeeswarm function checks the if the givencolor is of typematplotlib.colors.Colormap in one else path of the function and access the attributecolors if that check is true (it is in line454). However, not all subtypes ofmatplotlib.colors.Colormap have that attribute (see this [discussion])(https://stackoverflow.com/questions/59395038/why-the-structure-of-matplotlibs-color-maps-differ). Therefore this PR just add a further attribute check as well as a test, assuming that the type check should persist.

Checklist

  • Allpre-commit checks pass.
  • Unit tests added (if fixing a bug or adding a new feature)

Since not all subclasses of the mathplotlib base class `matplotlib.colors.Colormap` has the attribute `color`. Therefore the instance check is appended to also check the existence of that  attribute if it is base on `Colormap`.
@fabianliebigfabianliebig marked this pull request as ready for reviewMarch 12, 2025 18:54
@fabianliebigfabianliebig changed the titleFix/check for subclass to extract colorsFix/check for attribute to extract colorsMar 13, 2025
@CloseChoice
Copy link
Collaborator

@fabianliebig Thanks, this looks great. If the last test passes, I'll merge this. Don't worry about the macos test, this has nothing to do with your changes.

@CloseChoice
Copy link
Collaborator

@fabianliebig Thanks a lot for your efforts. Happy to see you contribute to shap

fabianliebig reacted with rocket emoji

@CloseChoiceCloseChoice merged commit1dcbb2a intoshap:masterMar 14, 2025
15 of 16 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@fabianliebig@CloseChoice

[8]ページ先頭

©2009-2025 Movatter.jp