Skip to content

Commit 8ff5f51

Browse files
BUG: addresses pandas-dev#14855 by fixing color kwarg conflict
DOC: add whats new entry for addressing pandas-dev#14855 TEST: add test for adding color kwarg to scatter_matrix BUG: add comment that addresses the issue BUG: set default edgecolor to none and fix facecolor TST: add facecolor test BUG: remove new changes and old bug fix
1 parent 9d3554c commit 8ff5f51

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

doc/source/whatsnew/v0.19.2.txt

+3
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@ Bug Fixes
8080
- Explicit check in ``to_stata`` and ``StataWriter`` for out-of-range values when writing doubles (:issue:`14618`)
8181
- Bug in ``.plot(kind='kde')`` which did not drop missing values to generate the KDE Plot, instead generating an empty plot. (:issue:`14821`)
8282
- Bug in ``unstack()`` if called with a list of column(s) as an argument, regardless of the dtypes of all columns, they get coerced to ``object`` (:issue:`11847`)
83+
84+
- Bug in ``pd.scatter_matrix()`` could accept either ``color`` or ``c``, but
85+
not both (:issue:`14855`)

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)