8000 Adds check that rgb sequence is of length 3 by GregoryAshton · Pull Request #3092 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Adds check that rgb sequence is of length 3 #3092

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 2, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Removes unnecessary float conversions
  • Loading branch information
GregoryAshton committed May 29, 2014
commit dcf9a6e5988762df567ae4c84828f194516a4a46
4 changes: 2 additions & 2 deletions lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def to_rgba(self, arg, alpha=None):
try:
if not cbook.is_string_like(arg) and cbook.iterable(arg):
if len(arg) == 4:
if any(float(x) < 0. or float(x) > 1. for x in arg):
if any(float(x) < 0 or x > 1 for x in arg):
raise ValueError(
'number in rbga sequence outside 0-1 range')
if alpha is None:
Expand All @@ -359,7 +359,7 @@ def to_rgba(self, arg, alpha=None):
return arg[0], arg[1], arg[2], alpha
if len(arg) == 3:
r, g, b = arg
if any(float(x) < 0. or float(x) > 1. for x in arg):
if any(float(x) < 0 or x > 1 for x in arg):
raise ValueError(
'number in rbg sequence outside 0-1 range')
else:
Expand Down
0