VIS: Allow 'C0'-like plotting for plotting colors #15516
State: closed

 - [x] closes #15516 
 - [x] tests added / passed
 - [x] passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff``
 - [x] whatsnew entry

Defined special case for 'CN' cases where N is 0 to 9. There may be custom color cycles that can also be parsed as a single color so the ValueError message is left intact (unless this is false).

```
running: pytest --skip-slow --skip-network pandas
============================= test session starts ==============================
platform linux2 -- Python 2.7.13, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
rootdir: /home/sfoo/pandas, inifile: setup.cfg
collected 11894 items / 3 skipped 

10234 passed, 1586 skipped, 77 xfailed, 2084 pytest-warnings in 486.80 seconds 
```

Labels:
name: Visualization
description: plotting

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=h1) Report
> Merging [#15873](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/cd24fa95f1781b14d35eac4953bab02691fd9d04?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `50%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/15873/graphs/tree.svg?token=eZ4WkYLtcO&width=650&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #15873      +/-   ##
==========================================
+ Coverage   90.99%   90.99%   +<.01%     
==========================================
  Files         143      143              
  Lines       49479    49481       +2     
==========================================
+ Hits        45021    45023       +2     
  Misses       4458     4458
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.75% <50%> (+0.01%)` | :arrow_up: |
| #single | `40.63% <0%> (-0.12%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tools/plotting.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL3Rvb2xzL3Bsb3R0aW5nLnB5) | `72.27% <50%> (+0.5%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.56% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=footer). Last update [cd24fa9...e249722](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=h1) Report
> Merging [#15873](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/ba30e3a2e376035549b009079d44ba5ca7a4c48f?src=pr&el=desc) will **increase** coverage by `0.07%`.
> The diff coverage is `77.77%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/15873/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #15873      +/-   ##
==========================================
+ Coverage   90.95%   91.03%   +0.07%     
==========================================
  Files         145      145              
  Lines       49534    49582      +48     
==========================================
+ Hits        45056    45136      +80     
+ Misses       4478     4446      -32
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.8% <77.77%> (+0.07%)` | :arrow_up: |
| #single | `40.57% <0%> (-0.09%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tools/plotting.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL3Rvb2xzL3Bsb3R0aW5nLnB5) | `72.47% <77.77%> (+0.71%)` | :arrow_up: |
| [pandas/indexes/frozen.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL2luZGV4ZXMvZnJvemVuLnB5) | `91.17% <0%> (-2.38%)` | :arrow_down: |
| [pandas/core/indexing.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhpbmcucHk=) | `94.01% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/internals.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzLnB5) | `93.54% <0%> (-0.08%)` | :arrow_down: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.89% <0%> (-0.08%)` | :arrow_down: |
| [pandas/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL2luZGV4ZXMvYmFzZS5weQ==) | `96.09% <0%> (-0.06%)` | :arrow_down: |
| [pandas/core/reshape.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS5weQ==) | `99.27% <0%> (-0.01%)` | :arrow_down: |
| [pandas/tslib.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL3RzbGliLnB5) | `100% <0%> (ø)` | :arrow_up: |
| [pandas/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL19faW5pdF9fLnB5) | `92.68% <0%> (ø)` | :arrow_up: |
| [pandas/tseries/tools.py](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvdG9vbHMucHk=) | `85.55% <0%> (ø)` | :arrow_up: |
| ... and [14 more](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=footer). Last update [ba30e3a...9d15e7d](https://codecov.io/gh/pandas-dev/pandas/pull/15873?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
In order to pass tests on matplotlib 1.5, converting C[0-9] to a hex code works, but the tests are not as meaningful since there are already tests for that.
Maybe we shouldn't try to support matplotlib versions < 2.0.0 ? It is only a feature from that version? The we also don't have the problem of failing tests on older matplotlib version (as the test could just be skipped for those) 
On the other hand it is not that difficult to convert to hex color
Fixed test and figured out how to test only for matplotlib >= 2.0.0

The test for `color=''` does not include a case in a list (e.g.  `color=['r'ed, ''`) because matplotlib will throw the error when trying to convert to_rgba.

There seems to be no remaining cases where a string passed as a color can also be parsed as an additional color outside of `C[0-9]` since the other color cycle is `bgrcmyk`. It could be possible by defining a custom color cycle but not obvious on how to accomplish this.

https://github.com/GuessWhoSamFoo/pandas/blob/str_color_cycle/pandas/tools/plotting.py#L236-L239
@GuessWhoSamFoo thanks!