Repository: pandas-dev/pandas

Issue:
single column DF plot, color problem
```
import pylab
import pandas.util.testing as put
df = put.makeTimeDataFrame()
pylab.figure()
df[ ['A'] ].plot(color = ['r'])
pylab.savefig('C:/tmp.png')
```

will give an error

```
raise ValueError('to_rgba: Invalid rgba arg "%s"\n%s' % (str(arg), exc))
ValueError: to_rgba: Invalid rgba arg "['r']"
```

All you need to do is to de-list the color parameter

```
df[ ['A'] ].plot(color = 'r')    
```

No problem if df is more than one columns.

```
df.plot(color = ['r','k'])
```

single column DF plot, color problem
```
import pylab
import pandas.util.testing as put
df = put.makeTimeDataFrame()
pylab.figure()
df[ ['A'] ].plot(color = ['r'])
pylab.savefig('C:/tmp.png')
```

will give an error

```
raise ValueError('to_rgba: Invalid rgba arg "%s"\n%s' % (str(arg), exc))
ValueError: to_rgba: Invalid rgba arg "['r']"
```

All you need to do is to de-list the color parameter

```
df[ ['A'] ].plot(color = 'r')    
```

No problem if df is more than one columns.

```
df.plot(color = ['r','k'])
```



Discussion:
Thanks. This is actually passed over to matplotlib as-is via `**kwds`,  the user is responsible for 
passing in something matplotlib likes.

closing as 'won't fix'.

Thanks. Maybe I'm not making myself clear enough

Say you start with a big DF and a list of its columns and assign a color to each column.

```
A = DF.columns
C = ['r','b','g',...]
```

Now you do some manipulations to filter out unwanted columns, eg

```
A = A[:x]
C = C[:x]
```

and in the end, you plot

```
DF[A].plot(color=C)
```

Now if x > 1, you won't have any problem, but it's possible x=1 and will result in the above error.

I don't think it's the user's responsibility here to write an awkward check 

```
color = C[0] if len(C)==1 else C
```

Thanks, I do see your point. The implicit rule of thumb is: if it's not an explicit argument
of the method, pandas is not responsible. You scenario probably applied to other arguments besides
`color`s.  I think it _is_ better to tell the user he is responsible then to selectively special-case some 
arguments and not others. 

It may be possible to make singleton dataframes work as expected here without touching
`kwds`, PRs welcome.

Thanks. This is actually passed over to matplotlib as-is via `**kwds`,  the user is responsible for 
passing in something matplotlib likes.

closing as 'won't fix'.

Thanks. Maybe I'm not making myself clear enough

Say you start with a big DF and a list of its columns and assign a color to each column.

```
A = DF.columns
C = ['r','b','g',...]
```

Now you do some manipulations to filter out unwanted columns, eg

```
A = A[:x]
C = C[:x]
```

and in the end, you plot

```
DF[A].plot(color=C)
```

Now if x > 1, you won't have any problem, but it's possible x=1 and will result in the above error.

I don't think it's the user's responsibility here to write an awkward check 

```
color = C[0] if len(C)==1 else C
```

Thanks, I do see your point. The implicit rule of thumb is: if it's not an explicit argument
of the method, pandas is not responsible. You scenario probably applied to other arguments besides
`color`s.  I think it _is_ better to tell the user he is responsible then to selectively special-case some 
arguments and not others. 

It may be possible to make singleton dataframes work as expected here without touching
`kwds`, PRs welcome.


Resolving patch:
diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py
--- 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']]
 


Test patch:
diff --git a/pandas/tests/plotting/test_frame.py b/pandas/tests/plotting/test_frame.py
--- 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):