Skip to content

Commit

Permalink
Make color validation more forgiving
Browse files Browse the repository at this point in the history
The current version throws a false positive if the style string contains `s` or `o`, which are valid marker styles and not colors.  For example:

```
style='s', color='C3'
```

should be legal, but currently throws an error.

My suggestion is to check for only the letters that are color codes.
  • Loading branch information
AllenDowney authored Oct 20, 2019
1 parent 0efc71b commit a6d6d89
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pandas/plotting/_matplotlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def _validate_color_args(self):
styles = [self.style]
# need only a single match
for s in styles:
if re.match("^[a-z]+?", s) is not None:
if re.match("^[bgrcmykw]+?", s) is not None:
raise ValueError(
"Cannot pass 'style' string with a color "
"symbol and 'color' keyword argument. Please"
Expand Down

0 comments on commit a6d6d89

Please sign in to comment.