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

FIX 2-tuple of colors in to_rgba_array#26952

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

Merged
timhoffm merged 1 commit intomatplotlib:mainfromrcomer:rgba-2tuple
Sep 29, 2023

Conversation

rcomer
Copy link
Member

PR summary

Fixes#26949. We just shouldn't assume that a 2-tuple passed toto_rgba_array is a single (color, alpha) pair.

PR checklist

@rcomerrcomer added the PR: bugfixPull requests that fix identified bugs labelSep 28, 2023
@@ -435,7 +435,7 @@ def to_rgba_array(c, alpha=None):
(n, 4) array of RGBA colors, where each channel (red, green, blue,
alpha) can assume values between 0 and 1.
"""
if isinstance(c, tuple) and len(c) == 2:
if isinstance(c, tuple) and len(c) == 2 and isinstance(c[1], (int, float)):
Copy link
Member

Choose a reason for hiding this comment

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

We haveReal here, I think:

Suggested change
ifisinstance(c,tuple)andlen(c)==2andisinstance(c[1],(int,float)):
ifisinstance(c,tuple)andlen(c)==2andisinstance(c[1],Real):

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Thanks! I think I knew that in the past but then forgot...

Done.

@timhoffmtimhoffm merged commit2cb8c6a intomatplotlib:mainSep 29, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestSep 29, 2023
@rcomerrcomer deleted the rgba-2tuple branchSeptember 29, 2023 19:47
oscargus added a commit that referenced this pull requestOct 2, 2023
…952-on-v3.8.xBackport PR#26952 on branch v3.8.x (FIX 2-tuple of colors in to_rgba_array)
@ksundenksunden mentioned this pull requestNov 2, 2023
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic left review comments

@tacaswelltacaswelltacaswell approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Labels
PR: bugfixPull requests that fix identified bugstopic: color/color & colormaps
Projects
None yet
Milestone
v3.8.1
Development

Successfully merging this pull request may close these issues.

[Bug]: colors.LinearSegmentedColormap.from_list does not take two tuples in 3.8.0
4 participants
@rcomer@tacaswell@QuLogic@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp