BUG-26214 fix colors parameter in DataFrame.boxplot
State: closed

- [X] closes #26214
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry

This PR fixes issues in the handling of the `color` parameter in the implementation of `DataFrame.boxplot` that do not exist in `DataFrame.plot.box`

- the `color` parameter is now removed from `kwds` before the `matplotlib` call, preventing an error
- an alternative implementation of color extraction from `color`, as `_get_standard_colors` did not preserve the appropriate order (without looking at that function, one can see that the previous implementation would give the boxes and the medians the same color even when otherwise specified)
- checking that `color` is actually a `dict`


Labels:
name: Bug
name: Visualization
description: plotting

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

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

```diff
@@            Coverage Diff             @@
##           master   #26456      +/-   ##
==========================================
- Coverage   91.73%   91.73%   -0.01%     
==========================================
  Files         174      174              
  Lines       50754    50762       +8     
==========================================
+ Hits        46560    46565       +5     
- Misses       4194     4197       +3
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.23% <100%> (ø)` | :arrow_up: |
| #single | `41.68% <0%> (-0.1%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26456?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/26456/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `84.06% <100%> (+0.16%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26456/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26456/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.02% <0%> (-0.12%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26456?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/26456?src=pr&el=footer). Last update [80bddaf...5cc6812](https://codecov.io/gh/pandas-dev/pandas/pull/26456?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/26456?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@9c7e604`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff            @@
##             master   #26456   +/-   ##
=========================================
  Coverage          ?   91.86%           
=========================================
  Files             ?      179           
  Lines             ?    50712           
  Branches          ?        0           
=========================================
  Hits              ?    46585           
  Misses            ?     4127           
  Partials          ?        0
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.45% <100%> (?)` | |
| #single | `41.11% <0%> (?)` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26456?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/plotting/\_matplotlib/boxplot.py](https://codecov.io/gh/pandas-dev/pandas/pull/26456/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19tYXRwbG90bGliL2JveHBsb3QucHk=) | `77.37% <100%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26456?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/26456?src=pr&el=footer). Last update [9c7e604...9c6fc49](https://codecov.io/gh/pandas-dev/pandas/pull/26456?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

So does `plot.box` accept this and are they now fully aligned? cc @datapythonista
Would be nice to wait until #26414 is in master to merge this.
we merged the refactor of the mpl backend, can you merge master and update to the new locations.
@jreback I've merged master and updated the PR
@JustinZhengBC can you move whatsnew to 1.0.0 and merge master?
@WillAyd done
@JustinZhengBC can you merge master and fix merge conflict?

@TomAugspurger any thoughts on this? If not planning to merge in 2 days
Fixed the merge conflict. Merge on green.
Thanks @JustinZhengBC !