Skip to content

Commit ba30e3a

Browse files
alexandercboothTomAugspurger
authored andcommitted
BUG: addresses #14855 by fixing color kwarg conflict
- [x] closes #14855 - [x] tests passed - [x] passes ``git diff upstream/master | flake8 --diff`` Author: alexandercbooth <[email protected]> This patch had conflicts when merged, resolved by Committer: Tom Augspurger <[email protected]> Closes #14871 from alexandercbooth/fix-color-scatterm-bug and squashes the following commits: 3245f09 [alexandercbooth] DOC: moving whatsnew entry to 0.20.0 8ff5f51 [alexandercbooth] BUG: addresses #14855 by fixing color kwarg conflict
1 parent e4e87ec commit ba30e3a

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

doc/source/whatsnew/v0.20.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,7 @@ Plotting
10561056

10571057
- Bug in ``DataFrame.hist`` where ``plt.tight_layout`` caused an ``AttributeError`` (use ``matplotlib >= 2.0.1``) (:issue:`9351`)
10581058
- Bug in ``DataFrame.boxplot`` where ``fontsize`` was not applied to the tick labels on both axes (:issue:`15108`)
1059+
- Bug in ``pd.scatter_matrix()`` could accept either ``color`` or ``c``, but not both (:issue:`14855`)
10591060

10601061
Groupby/Resample/Rolling
10611062
^^^^^^^^^^^^^^^^^^^^^^^^

pandas/tests/plotting/test_misc.py

+6
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ def scat(**kwds):
7676
_check_plot_works(scat, diagonal='hist')
7777
with tm.assert_produces_warning(UserWarning):
7878
_check_plot_works(scat, range_padding=.1)
79+
with tm.assert_produces_warning(UserWarning):
80+
_check_plot_works(scat, color='rgb')
81+
with tm.assert_produces_warning(UserWarning):
82+
_check_plot_works(scat, c='rgb')
83+
with tm.assert_produces_warning(UserWarning):
84+
_check_plot_works(scat, facecolor='rgb')
7985

8086
def scat2(x, y, by=None, ax=None, figsize=None):
8187
return plotting.scatter_plot(df, x, y, by, ax, figsize=None)

pandas/tools/plotting.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False,
349349
>>> df = DataFrame(np.random.randn(1000, 4), columns=['A','B','C','D'])
350350
>>> scatter_matrix(df, alpha=0.2)
351351
"""
352-
import matplotlib.pyplot as plt
353352

354353
df = frame._get_numeric_data()
355354
n = df.columns.size
@@ -367,8 +366,8 @@ def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False,
367366
hist_kwds = hist_kwds or {}
368367
density_kwds = density_kwds or {}
369368

370-
# workaround because `c='b'` is hardcoded in matplotlibs scatter method
371-
kwds.setdefault('c', plt.rcParams['patch.facecolor'])
369+
# GH 14855
370+
kwds.setdefault('edgecolors', 'none')
372371

373372
boundaries_list = []
374373
for a in df.columns:
@@ -2864,8 +2863,7 @@ def scatter_plot(data, x, y, by=None, ax=None, figsize=None, grid=False,
28642863
"""
28652864
import matplotlib.pyplot as plt
28662865

2867-
# workaround because `c='b'` is hardcoded in matplotlibs scatter method
2868-
kwargs.setdefault('c', plt.rcParams['patch.facecolor'])
2866+
kwargs.setdefault('edgecolors', 'none')
28692867

28702868
def plot_group(group, ax):
28712869
xvals = group[x].values

0 commit comments

Comments
 (0)