Skip to content

Commit bcdc98f

Browse files
committed
Merge pull request #5060 from jorisvandenbossche/scatter-color
VIS: let scatter plots obey mpl color scheme (#3338)
2 parents 9d3fdfd + 3d03e91 commit bcdc98f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tools/plotting.py

+11
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False,
229229
>>> df = DataFrame(np.random.randn(1000, 4), columns=['A','B','C','D'])
230230
>>> scatter_matrix(df, alpha=0.2)
231231
"""
232+
import matplotlib.pyplot as plt
232233
from matplotlib.artist import setp
233234

234235
df = frame._get_numeric_data()
@@ -246,6 +247,9 @@ def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False,
246247
hist_kwds = hist_kwds or {}
247248
density_kwds = density_kwds or {}
248249

250+
# workaround because `c='b'` is hardcoded in matplotlibs scatter method
251+
kwds.setdefault('c', plt.rcParams['patch.facecolor'])
252+
249253
for i, a in zip(lrange(n), df.columns):
250254
for j, b in zip(lrange(n), df.columns):
251255
ax = axes[i, j]
@@ -653,6 +657,10 @@ def lag_plot(series, lag=1, ax=None, **kwds):
653657
ax: Matplotlib axis object
654658
"""
655659
import matplotlib.pyplot as plt
660+
661+
# workaround because `c='b'` is hardcoded in matplotlibs scatter method
662+
kwds.setdefault('c', plt.rcParams['patch.facecolor'])
663+
656664
data = series.values
657665
y1 = data[:-lag]
658666
y2 = data[lag:]
@@ -1889,6 +1897,9 @@ def scatter_plot(data, x, y, by=None, ax=None, figsize=None, grid=False, **kwarg
18891897
"""
18901898
import matplotlib.pyplot as plt
18911899

1900+
# workaround because `c='b'` is hardcoded in matplotlibs scatter method
1901+
kwargs.setdefault('c', plt.rcParams['patch.facecolor'])
1902+
18921903
def plot_group(group, ax):
18931904
xvals = group[x].values
18941905
yvals = group[y].values

0 commit comments

Comments
 (0)