BUG: fix matplotlib warning on CN color
State: closed

- [ ] closes #36972
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Visualization
description: plotting
name: Clean

Comments:
CI checks failure due to pyx files, not because of my change.
cc @charlesdong1991 
Just confirming that the concerned warning is not raised anymore.

```
(base) root@f31dd4516194:/workspaces/pandas# pytest pandas/tests/plotting/test_frame.py
======================================================================================================================== test session starts =========================================================================================================================
platform linux -- Python 3.7.7, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
rootdir: /workspaces/pandas, configfile: setup.cfg
plugins: cov-2.10.0, forked-1.2.0, xdist-1.34.0, hypothesis-5.23.11, asyncio-0.12.0
collected 186 items                                                                                                                                                                                                                                                  

pandas/tests/plotting/test_frame.py ...........................x.................................................................................................x............................................................                                 [100%]

========================================================================================================================== warnings summary ==========================================================================================================================
pandas/tests/plotting/test_frame.py::TestDataFramePlots::test_errorbar_plot
pandas/tests/plotting/test_frame.py::TestDataFramePlots::test_errorbar_plot
pandas/tests/plotting/test_frame.py::TestDataFramePlots::test_errorbar_plot
pandas/tests/plotting/test_frame.py::TestDataFramePlots::test_errorbar_timeseries
pandas/tests/plotting/test_frame.py::TestDataFramePlots::test_errorbar_timeseries
pandas/tests/plotting/test_frame.py::TestDataFramePlots::test_errorbar_timeseries
  /workspaces/pandas/pandas/plotting/_matplotlib/__init__.py:61: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared
    plot_obj.generate()

-- Docs: https://docs.pytest.org/en/stable/warnings.html
======================================================================================================= 184 passed, 2 xfailed, 6 warnings in 62.41s (0:01:02) ========================================================================================================
(base) root@f31dd4516194:/workspaces/pandas#
```

The other warnings are handled here https://github.com/pandas-dev/pandas/pull/36982
For some reason the test fails in Travis CI.

```
=================================== FAILURES ===================================

_________________ TestDataFramePlots.test_mpl2_color_cycle_str _________________

[gw0] linux -- Python 3.7.8 /home/travis/miniconda3/envs/pandas-dev/bin/python

self = <pandas.tests.plotting.test_frame.TestDataFramePlots object at 0x7f022d75ca90>
    def test_mpl2_color_cycle_str(self):
        # GH 15516
        df = DataFrame(randn(10, 3), columns=["a", "b", "c"])
        colors = ["C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9"]
        with warnings.catch_warnings(record=True) as w:
            # GH 36972
            warnings.simplefilter("always", "MatplotlibDeprecationWarning")

            for color in colors:
                _check_plot_works(df.plot, color=color)

            no_warning_raised = len(w) == 0
>           assert no_warning_raised, "MatplotlibDeprecationWarning was raised"
E           AssertionError: MatplotlibDeprecationWarning was raised
E           assert False

pandas/tests/plotting/test_frame.py:183: AssertionError
```
I would only think that the error happened because of some other deprecation warning for that particular environment.
I thus changed assertion to match the actual deprecation warning message. We'll see how it goes.
Looks like now everything works. The new test fails on master branch, but succeeds with this PR changes.
emm, just make sure it's not a flaky error, maybe try to rebase one more time to see if the failure comes back?

btw, does this need a whatsnew? probably no, right?
All checks pass. Neither the warning was raised (I checked all Travis logs) nor the test fail (like it should if this warning is raised).
Regarding the whatsnew - I don't know. What would others think?
lgtm. @charlesdong1991 merge if good here.
this is fine