Skip to content

Commit 00b7b88

Browse files
committed
test, fixup
1 parent cab3a0e commit 00b7b88

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pandas/plotting/_matplotlib/core.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ def __init__(
193193
self._validate_color_args()
194194

195195
def _validate_color_args(self):
196+
import matplotlib.colors
197+
196198
if "color" not in self.kwds and "colors" in self.kwds:
197199
warnings.warn(
198200
(
@@ -234,7 +236,7 @@ def _validate_color_args(self):
234236
styles = [self.style]
235237
# need only a single match
236238
for s in styles:
237-
if re.match("^[a-z]+?", s) is not None:
239+
if s in matplotlib.colors.BASE_COLORS:
238240
raise ValueError(
239241
"Cannot pass 'style' string with a color "
240242
"symbol and 'color' keyword argument. Please"

pandas/tests/plotting/test_series.py

+4
Original file line numberDiff line numberDiff line change
@@ -931,3 +931,7 @@ def test_plot_no_numeric_data(self):
931931
df = pd.Series(["a", "b", "c"])
932932
with pytest.raises(TypeError):
933933
df.plot()
934+
935+
def test_style_single_ok(self):
936+
s = pd.Series([1, 2])
937+
s.plot(style="s", color="C3")

0 commit comments

Comments
 (0)