diff --git a/doc/source/whatsnew/v0.20.2.txt b/doc/source/whatsnew/v0.20.2.txt index 983f3edfa2f46..cbfebee2ceba2 100644 --- a/doc/source/whatsnew/v0.20.2.txt +++ b/doc/source/whatsnew/v0.20.2.txt @@ -55,6 +55,8 @@ I/O Plotting ^^^^^^^^ +- Bug in ``DataFrame.plot`` with a single column and a list-like ``color`` (:issue:`3486`) + diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index e88979b14c8af..c0f9f62106330 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -180,7 +180,8 @@ def _validate_color_args(self): colors = self.kwds.pop('colors') self.kwds['color'] = colors - if ('color' in self.kwds and self.nseries == 1): + if ('color' in self.kwds and self.nseries == 1 and + not is_list_like(self.kwds['color'])): # support series.plot(color='green') self.kwds['color'] = [self.kwds['color']] diff --git a/pandas/tests/plotting/test_frame.py b/pandas/tests/plotting/test_frame.py index 9abbb348fbfa8..e40ec5a1faea8 100644 --- a/pandas/tests/plotting/test_frame.py +++ b/pandas/tests/plotting/test_frame.py @@ -153,6 +153,11 @@ def test_mpl2_color_cycle_str(self): else: pytest.skip("not supported in matplotlib < 2.0.0") + def test_color_single_series_list(self): + # GH 3486 + df = DataFrame({"A": [1, 2, 3]}) + _check_plot_works(df.plot, color=['red']) + def test_color_empty_string(self): df = DataFrame(randn(10, 2)) with pytest.raises(ValueError):