Skip to content

Commit f3764db

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 2c45ed3 commit f3764db

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-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

+4-5
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def _mpl_ge_2_0_0():
149149
except ImportError:
150150
return False
151151

152+
152153
if _mpl_ge_1_5_0():
153154
# Compat with mp 1.5, which uses cycler.
154155
import cycler
@@ -340,7 +341,6 @@ def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False,
340341
>>> df = DataFrame(np.random.randn(1000, 4), columns=['A','B','C','D'])
341342
>>> scatter_matrix(df, alpha=0.2)
342343
"""
343-
import matplotlib.pyplot as plt
344344

345345
df = frame._get_numeric_data()
346346
n = df.columns.size
@@ -358,8 +358,8 @@ def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False,
358358
hist_kwds = hist_kwds or {}
359359
density_kwds = density_kwds or {}
360360

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

364364
boundaries_list = []
365365
for a in df.columns:
@@ -2855,8 +2855,7 @@ def scatter_plot(data, x, y, by=None, ax=None, figsize=None, grid=False,
28552855
"""
28562856
import matplotlib.pyplot as plt
28572857

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

28612860
def plot_group(group, ax):
28622861
xvals = group[x].values

0 commit comments

Comments
 (0)