VIS: Fix DataFrame.plot() produces incorrect legend markers when plotting multiple series on the same axis
State: closed

I found out that the reason this happens is because `subplots` is not updated accordingly when `plt.subplots()` is used and assign to `ax`, e.g. `fig, ax = plt.subplots(nrows=1, ncols=3)`. I tested my solution and things all get solved, and figure looks very correct like below:
![Screen Shot 2019-08-07 at 10 03 39 PM](https://user-images.githubusercontent.com/9269816/62654665-95a30a80-b960-11e9-94ad-ab43a0e8a3cf.png)

BTW, i am not very sure how to properly test this, and would be nice to know!

- [x] closes #18222
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Visualization
description: plotting

Comments:
@TomAugspurger thanks very much for your quick review! Just curious about what you mean by `Does the issue post have one?` this issue does provide a fail case, but no test is given. 
I do see some tests for plotting, but since this issue is mainly about missing markers in legend, i haven't found a proper solution to test if this marker/color is printed correctly. Would be very nice if you could give some hint! ^^
Ideally we would make a plot and verify that the legend labels and markers
are matched up. I can never remember the matplotlib API for that though.

On Wed, Aug 7, 2019 at 4:16 PM Kaiqi Dong <notifications@github.com> wrote:

> @TomAugspurger <https://github.com/TomAugspurger> thanks very much for
> your quick review! Just curious about what you mean by Does the issue
> post have one? this issue does provide a fail case, but no test is given.
> I do see some tests for plotting, but since this failure is mainly caused
> by missing markers in legend, haven't found a proper solution to test if
> this marker/color is printed correctly. Would be very nice if you could
> give some hint! ^^
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/27808?email_source=notifications&email_token=AAKAOITMP33G25W33WD6V2TQDM3STA5CNFSM4IKD3SXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3ZXOFA#issuecomment-519272212>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAKAOITIAQNWQETQ7ESO74LQDM3STANCNFSM4IKD3SXA>
> .
>

Thanks for your quick reply, I will check it up @TomAugspurger 
Hello @charlesdong1991! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:







There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-08-14 20:47:39 UTC
This is kind of new working solution with a test case that is passing all tests on my local computer, not sure if it can also pass all tests here. But in the meantime pls feel free to take a look and provide reviews if you have some time. @TomAugspurger 
any follow-up reviews? all are much appreciated! ^^
Looks good. I'll restart the windows azure CI failure.
ping
Thanks!
If you need another example of this problem let me know