From a6d6d8939e93e24d54053b9ec3f72ee55eb19140 Mon Sep 17 00:00:00 2001 From: Allen Downey Date: Sun, 20 Oct 2019 19:48:13 -0400 Subject: [PATCH] Make color validation more forgiving 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. --- pandas/plotting/_matplotlib/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py index 519465802085bb..e60f56d470a739 100644 --- a/pandas/plotting/_matplotlib/core.py +++ b/pandas/plotting/_matplotlib/core.py @@ -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"