Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
lib/matplotlib/colors.py Outdated
@@ -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)): |
There was a problem hiding this comment.
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:
ifisinstance(c,tuple)andlen(c)==2andisinstance(c[1],(int,float)): | |
ifisinstance(c,tuple)andlen(c)==2andisinstance(c[1],Real): |
There was a problem hiding this comment.
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.
…952-on-v3.8.xBackport PR#26952 on branch v3.8.x (FIX 2-tuple of colors in to_rgba_array)
PR summary
Fixes#26949. We just shouldn't assume that a 2-tuple passed to
to_rgba_array
is a single (color, alpha) pair.PR checklist